[CDB] RH Topic Tags

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Get Involved
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
Locked
combuster
Registered User
Posts: 342
Joined: Sun Oct 26, 2008 11:58 pm

Re: [BETA] RH Topic Tags

Post by combuster »

@strelok-by: your PHP-Version could be out of date. Be sure to use a up-to-date PHP version. However, I will try to ommit the mb_strlen, because its not enabled by default: https://github.com/RobertHeim/phpbb-ext ... /issues/42 (already fixed in master branch)

@draky: there is a problem with the DELETE syntax for different DB-Systems and there is already an issue: https://github.com/RobertHeim/phpbb-ext ... /issues/41

User avatar
strelok-by
Registered User
Posts: 126
Joined: Fri Nov 21, 2014 10:22 am
Location: Mozyr / Belarus
Name: Stanislav
Contact:

Re: [BETA] RH Topic Tags

Post by strelok-by »

combuster wrote:@strelok-by: your PHP-Version could be out of date. Be sure to use a up-to-date PHP version. However, I will try to ommit the mb_strlen, because its not enabled by default: https://github.com/RobertHeim/phpbb-ext ... /issues/42 (already fixed in master branch)
Version PHP 5.6

User avatar
strelok-by
Registered User
Posts: 126
Joined: Fri Nov 21, 2014 10:22 am
Location: Mozyr / Belarus
Name: Stanislav
Contact:

Re: [BETA] RH Topic Tags

Post by strelok-by »

I've updated the expansion and now it is not displayed in the settings

User avatar
пхпBBGuRu
Registered User
Posts: 12
Joined: Sat Jan 03, 2015 11:40 am
Contact:

Re: [BETA] RH Topic Tags

Post by пхпBBGuRu »

combuster wrote:Be sure to use a up-to-date PHP version
No, just a hoster not activated mbstring
combuster wrote:However, I will try to ommit the mb_strlen, because its not enabled by default
This is not right, you should replace the code in /ext/robertheim/topictags/service/tags_manager.php

Code: Select all

        if (mb_strlen($query, 'UTF-8') < 3)
        {
            return array();
        }
onto

Code: Select all

        if(function_exists('mb_strlen'))
        {
            if (mb_strlen($query, 'UTF-8') < 3)
            {
                return array();
            }
        }
        else
        {
            $dummy = array();
            if (preg_match_all("/.{1}/us", $query, $dummy) < 3)
            return array();
        }

combuster
Registered User
Posts: 342
Joined: Sun Oct 26, 2008 11:58 pm

Re: [BETA] RH Topic Tags

Post by combuster »

пхпBBGuRu wrote:
combuster wrote:Be sure to use a up-to-date PHP version
No, just a hoster not activated mbstring
You should always use a up-to-date PHP version.

mbstrings is not used anymore in the extension. @nxnBBGuRu: your solution is correct in a technical way, but you would rather use the phpbb functions in includes/utf8/utf8_tools.php http://phpcrossref.com/xref/phpbb/inclu ... tf8_strlen

jbanana
Registered User
Posts: 2
Joined: Tue Jan 06, 2015 11:48 am

Re: [BETA] RH Topic Tags

Post by jbanana »

Hello,

I'm attempting to install the extension but i've run into a problem when enabling as follows:

Code: Select all

General Error
SQL ERROR [ sqlite3 ]

near "t": syntax error [1]

SQL

UPDATE phpbb_rh_topictags_tag t SET t.count = ( SELECT COUNT(tt.id) FROM phpbb_topics topics, phpbb_forums f, phpbb_rh_topictags tt WHERE tt.tag_id = t.id AND topics.topic_id = tt.topic_id AND f.forum_id = topics.forum_id AND f.rh_topictags_enabled = 1 )
Seems to me sqlite3 is not liking the table alias in update query. I'd rather not change database again (grr why was Firebird support dropped in 3.1? :( )

I tried beta12 and 13 from github. same result for both.

And thanks for doing the extension! I can't imagine why phpbb still doesn't come with topic tags by default.

combuster
Registered User
Posts: 342
Joined: Sun Oct 26, 2008 11:58 pm

Re: [BETA] RH Topic Tags

Post by combuster »

jbanana wrote: Seems to me sqlite3 is not liking the table alias in update query.
Thanks for hint. I will have a look to this, you will find updates there: https://github.com/RobertHeim/phpbb-ext ... /issues/43

jbanana
Registered User
Posts: 2
Joined: Tue Jan 06, 2015 11:48 am

Re: [BETA] RH Topic Tags

Post by jbanana »

I fixed the queries (update and delete) so it appears to work now with sqlite3. i can install the extension and make posts with tags and also search with tags.

Code: Select all

--- H:/phpbbstyles/phpbb-ext-topictags-0.0.12-BETA/service/tags_manager (2).php	Sat Nov 08 13:15:02 2014
+++ H:/phpbbstyles/phpbb-ext-topictags-0.0.12-BETA/service/tags_manager.php	Tue Jan 06 15:18:13 2015
@@ -70,12 +70,12 @@
 		// https://www.phpbb.com/community/viewtopic.php?f=461&t=2263646
 		// so we would need 2 queries, but this is slow... so we use subqueries and hope - yeah! :D
 
-		$sql = 'DELETE t
-			FROM ' . $this->table_prefix . TABLES::TAGS . ' t
+		$sql = 'DELETE
+			FROM ' . $this->table_prefix . TABLES::TAGS . '
 			WHERE NOT EXISTS (
 				SELECT 1
 				FROM ' . $this->table_prefix . TABLES::TOPICTAGS . ' tt
-					WHERE tt.tag_id = t.id
+					WHERE tt.tag_id = ' . $this->table_prefix . TABLES::TAGS . '.id
 			)';
 
 		$this->db->sql_query($sql);
@@ -101,9 +101,9 @@
 			}
 		}
 		// delete all tag-assignments where the tag is not valid
-		$sql = 'DELETE tt
-			FROM ' . $this->table_prefix . TABLES::TOPICTAGS . ' tt
-			WHERE ' . $this->db->sql_in_set('tt.tag_id', $ids_of_invalid_tags);
+		$sql = 'DELETE
+			FROM ' . $this->table_prefix . TABLES::TOPICTAGS . ' 
+			WHERE ' . $this->db->sql_in_set('tag_id', $ids_of_invalid_tags);
 		$this->db->sql_query($sql);
 		$removed_count = $this->db->sql_affectedrows();
 
@@ -120,12 +120,12 @@
 	public function delete_assignments_where_topic_does_not_exist()
 	{
 		// delete all tag-assignments where the topic does not exist anymore
-		$sql = 'DELETE tt
-			FROM ' . $this->table_prefix . TABLES::TOPICTAGS . ' tt
+		$sql = 'DELETE 
+			FROM ' . $this->table_prefix . TABLES::TOPICTAGS . ' 
 			WHERE NOT EXISTS (
 				SELECT 1
 				FROM ' . TOPICS_TABLE . ' topics
-					WHERE topics.topic_id = tt.topic_id
+					WHERE topics.topic_id = ' . $this->table_prefix . TABLES::TOPICTAGS . '.topic_id
 			)';
 		$this->db->sql_query($sql);
 		$removed_count = $this->db->sql_affectedrows();
@@ -161,13 +161,13 @@
 			$forums_sql_where = ' AND ' . $this->db->sql_in_set('f.forum_id', $int_ids);
 		}
 		// Deletes all topic-assignments to topics that reside in a forum with tagging disabled.
-		$sql = 'DELETE tt
-			FROM ' . $this->table_prefix . TABLES::TOPICTAGS . ' tt
+		$sql = 'DELETE 
+			FROM ' . $this->table_prefix . TABLES::TOPICTAGS . ' 
 			WHERE EXISTS (
 				SELECT 1
 				FROM ' . TOPICS_TABLE . ' topics,
 					' . FORUMS_TABLE . " f
-				WHERE topics.topic_id = tt.topic_id
+				WHERE topics.topic_id = ' . $this->table_prefix . TABLES::TOPICTAGS . '.topic_id
 					AND f.forum_id = topics.forum_id
 					AND f.rh_topictags_enabled = 0
 					$forums_sql_where
@@ -726,13 +726,13 @@
 	 */
 	public function calc_count_tags()
 	{
-		$sql = 'UPDATE ' . $this->table_prefix . TABLES::TAGS . ' t
-			SET t.count = (
+		$sql = 'UPDATE ' . $this->table_prefix . TABLES::TAGS . ' 
+			SET count = (
 				SELECT COUNT(tt.id)
 				FROM ' . TOPICS_TABLE . ' topics,
 					' . FORUMS_TABLE . ' f,
 					' . $this->table_prefix . TABLES::TOPICTAGS . ' tt
-				WHERE tt.tag_id = t.id
+				WHERE tt.tag_id = ' . $this->table_prefix . TABLES::TAGS . '.id
 					AND topics.topic_id = tt.topic_id
 					AND f.forum_id = topics.forum_id
 					AND f.rh_topictags_enabled = 1
@@ -783,18 +783,18 @@
 		
 		// delete assignments where the new tag is already assigned
 		$topic_ids_already_assigned = $this->get_topic_ids_by_tag_id($tag_to_keep_id);
-		$sql = 'DELETE tt FROM ' . $this->table_prefix . TABLES::TOPICTAGS. ' tt
-			WHERE ' . $this->db->sql_in_set('tt.topic_id', $topic_ids_already_assigned) . '
-				AND tt.tag_id = ' . (int) $tag_to_delete_id;
+		$sql = 'DELETE FROM ' . $this->table_prefix . TABLES::TOPICTAGS. ' 
+			WHERE ' . $this->db->sql_in_set('topic_id', $topic_ids_already_assigned) . '
+				AND tag_id = ' . (int) $tag_to_delete_id;
 		$this->db->sql_query($sql);
 
 		// renew assignments where the new tag is not assigned, yet
 		$sql_ary = array(
-			'tt.tag_id'	=> $tag_to_keep_id,
+			$this->table_prefix . TABLES::TOPICTAGS . '.tag_id'	=> $tag_to_keep_id,
 		);
-		$sql = 'UPDATE ' . $this->table_prefix . TABLES::TOPICTAGS . ' tt
+		$sql = 'UPDATE ' . $this->table_prefix . TABLES::TOPICTAGS . ' 
 			SET  ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
-			WHERE tt.tag_id = ' . (int) $tag_to_delete_id;
+			WHERE ' . $this->table_prefix . TABLES::TOPICTAGS . '.tag_id = ' . (int) $tag_to_delete_id;
 		$this->db->sql_query($sql);
 		
 		$this->delete_tag($tag_to_delete_id);
@@ -809,14 +809,14 @@
 	 */
 	public function delete_tag($tag_id)
 	{
-		$sql = 'DELETE tt
-			FROM ' . $this->table_prefix . TABLES::TOPICTAGS . ' tt
-			WHERE tt.tag_id = ' . ((int) $tag_id);
+		$sql = 'DELETE
+			FROM ' . $this->table_prefix . TABLES::TOPICTAGS . ' 
+			WHERE tag_id = ' . ((int) $tag_id);
 		$this->db->sql_query($sql);
 		
-		$sql = 'DELETE t
-			FROM ' . $this->table_prefix . TABLES::TAGS . ' t
-			WHERE t.id = ' . ((int) $tag_id);
+		$sql = 'DELETE
+			FROM ' . $this->table_prefix . TABLES::TAGS . '
+			WHERE id = ' . ((int) $tag_id);
 		$this->db->sql_query($sql);
 	}
 	
@@ -830,11 +830,11 @@
 	public function rename($tag_id, $new_name_clean)
 	{
 		$sql_ary = array(
-			't.tag'	=> $new_name_clean,
+			$this->table_prefix . TABLES::TAGS . '.tag'	=> $new_name_clean,
 		);
-		$sql = 'UPDATE ' . $this->table_prefix . TABLES::TAGS . ' t
+		$sql = 'UPDATE ' . $this->table_prefix . TABLES::TAGS . ' 
 			SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
-			WHERE t.id = ' . ((int) $tag_id);
+			WHERE ' . $this->table_prefix . TABLES::TAGS . '.id = ' . ((int) $tag_id);
 		$this->db->sql_query($sql);
 		return $this->count_topics_by_tags(array($new_name_clean), 'AND', true);
 	}


combuster
Registered User
Posts: 342
Joined: Sun Oct 26, 2008 11:58 pm

Re: [BETA] RH Topic Tags

Post by combuster »

Hi jbanana,

when posting patches, please make sure you use the master branch from github and post them as PR on github ( https://github.com/RobertHeim/phpbb-ext-topictags )
Furthermore, have you tried the master branch? Because there were several fixes in the past which have not been released until now. Some of them concerning SQL-fixes for Postgres which might fix sqlite as well. Also make sure that your patch works with
  • MySQL 3.23 or above (MySQLi supported)
  • MariaDB 5.1 or above (which is basically full MySQL compatible)
  • PostgreSQL 8.3+
  • SQLite 2.8.2+
  • SQLite 3.6.15+
  • MS SQL Server 2000 or above (directly or via ODBC or the native adapter)
  • Oracle

FrankPereiro
Registered User
Posts: 59
Joined: Tue Nov 16, 2004 3:36 pm
Location: Spain

Re: [BETA] RH Topic Tags

Post by FrankPereiro »

Is it possible to add this tags feature to our RSS list of feeds?

I think this is a great plugin, and I'm already using it in my forum. Works great.

Thanks.

TCEOFPPT
Registered User
Posts: 8
Joined: Tue Jan 27, 2015 2:27 pm
Location: Maroc
Name: Nabil Khairany
Contact:

Re: [BETA] RH Topic Tags

Post by TCEOFPPT »

very lovely mod
FORUM TCE OFPPT : http://tceofppt.info
technicien comptable d'entreprises

User avatar
Dskod1
Registered User
Posts: 44
Joined: Tue Jan 21, 2014 8:47 pm
Location: Australia
Name: Dylan Skoda
Contact:

Re: [BETA] RH Topic Tags

Post by Dskod1 »

Would be great if "Empire" and "empire" were not counted sepreatley in the word cloud just because one has a capital. Maybe make an option to convert all tags to either lowercase or uppercase? and add a maintenance for those that want to change mid-usage to all lowercase for example.

User avatar
sysz
Registered User
Posts: 278
Joined: Mon Jan 30, 2012 11:36 pm
Location: Sweden, Helsingborg
Name: Kimmy Lindell Ekström
Contact:

Re: [BETA] RH Topic Tags

Post by sysz »

Is there or will there be an option to have the show all tags page in the Quick links dropbox menu or anywhere else?
Currently working on the community

FomenkoAndrey
Registered User
Posts: 367
Joined: Thu Aug 19, 2010 10:44 am

Re: [BETA] RH Topic Tags

Post by FomenkoAndrey »

combuster, is this enough stable extension to be installed on a working site?
Are you planning to develop an extension for 3.2 branch and follow?
would not want to spend time creating tags in the topics and then lose them in any major update.
and when U plannig change status from BETA to RC?

FomenkoAndrey
Registered User
Posts: 367
Joined: Thu Aug 19, 2010 10:44 am

Re: [BETA] RH Topic Tags

Post by FomenkoAndrey »

install latest release of the ext 0.13 beta, forum 3.1.3.
previous version of tag topics was fully deleted from server and from base.

1 - at first, i dint see tag cloud at index page.
Tag cloud settings -- Display tag cloud on index: YES
tags was created.
+1 time fully reinstall - worked.

2 - when i use russian characters in tags, and go to that tags, i have url

Code: Select all

http://site/tag/%25D0%25B1%25D0%25BB%25D1%258F
but in russian it must be

Code: Select all

http://site/tag/бля
3 - create only tags only 1 topic - see any tags (counter = 3) in tag cloud
Image

Image

with any other tags - the same.

when i created tag "test1" in 4 topics - i see counter = 3 in tag cloud.

4 - fully delete extention and delete it from database.
then install it.
create tags in 1 topic...
see the same like in previous step (3), but all tags in tag cloud had counters = 4.

so many bags!

Locked

Return to “Extensions in Development”