Page 11 of 17

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Fri Jul 01, 2016 6:10 pm
by imkingdavid
To add to that, looking in phpbb/user.php I see there is also a core.user_setup_after event added in 3.1.6:

Code: Select all

		/**
		* Execute code at the end of user setup
		*
		* @event core.user_setup_after
		* @since 3.1.6-RC1
		*/
		$phpbb_dispatcher->dispatch('core.user_setup_after');
Because my event needs to run first, perhaps the fix would actually be for Elias to switch his to use user_setup_after instead of user_setup? I need to use at least user_setup in order to have access to the $user object.

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Fri Jul 01, 2016 6:13 pm
by kasimi
You can add a higher priority to your listener. From the getSubscribedEvents()docs:

Code: Select all

/**
 * Returns an array of event names this subscriber wants to listen to.
 *
 * The array keys are event names and the value can be:
 *
 *  * The method name to call (priority defaults to 0)
 *  * An array composed of the method name to call and the priority
 *  * An array of arrays composed of the method names to call and respective
 *    priorities, or 0 if unset
 *
 * For instance:
 *
 *  * array('eventName' => 'methodName')
 *  * array('eventName' => array('methodName', $priority))
 *  * array('eventName' => array(array('methodName1', $priority), array('methodName2')))
 *
 * @return array The event names to listen to
 */

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Fri Jul 01, 2016 7:48 pm
by imkingdavid
kasimi wrote:You can add a higher priority to your listener. From the getSubscribedEvents()docs:

Code: Select all

/**
 * Returns an array of event names this subscriber wants to listen to.
 *
 * The array keys are event names and the value can be:
 *
 *  * The method name to call (priority defaults to 0)
 *  * An array composed of the method name to call and the priority
 *  * An array of arrays composed of the method names to call and respective
 *    priorities, or 0 if unset
 *
 * For instance:
 *
 *  * array('eventName' => 'methodName')
 *  * array('eventName' => array('methodName', $priority))
 *  * array('eventName' => array(array('methodName1', $priority), array('methodName2')))
 *
 * @return array The event names to listen to
 */
Thanks for the info, I had forgotten about that. I'll look into that.

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Sat Jul 02, 2016 10:43 am
by imkingdavid
SalazarAG wrote:Hi again David!

You can take a look at this error? viewtopic.php?f=456&t=2355811&hilit=wel ... #p14440591

It seems to be a conflict between the two extensions and I can not use the other because of it :(
I've just pushed a change that should fix that. I tested it and it works for me.

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Sat Jul 02, 2016 12:48 pm
by SalazarAG
Hi David!

I updated the extension and when I enable Welcome Topic Robot and register new user test, I have this error



SQL ERROR [ mysqli ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 [1064]

An sql error occurred while fetching this page. Please contact an administrator if this problem persists.

Powered by phpBB® Forum Software © phpBB Limited
The error this time seems to be in the database :(

Is it because I do not deactivated [pre] fixed to update and simply replace it with the new files?

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Sat Jul 02, 2016 6:48 pm
by imkingdavid
Can you enable the DEBUG constant in the config.php file? I would need to see more information about the error to know what is causing it. When I enabled the WTR extension and had my fix in place, it submitted the post successfully when I registered a new user.

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Sun Jul 03, 2016 4:10 am
by SalazarAG
imkingdavid wrote:Can you enable the DEBUG constant in the config.php file? I would need to see more information about the error to know what is causing it. When I enabled the WTR extension and had my fix in place, it submitted the post successfully when I registered a new user.
I enabled and seems to be conflicting with another extension, this time hahaha

Code: Select all

[phpBB Debug] PHP Notice: in file [ROOT]/ext/marttiphpbb/usertopiccount/event/hard_update_listener.php on line 129: Undefined index: poster_id
SQL ERROR [ mysqli ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 [1064]

SQL

UPDATE phpbb_users SET user_topic_count = user_topic_count + 1 WHERE user_id =

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 855
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 193
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 329
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/ext/marttiphpbb/usertopiccount/event/hard_update_listener.php
LINE: 130
CALL: phpbb\db\driver\factory->sql_query()

FILE: (not given by php)
LINE: (not given by php)
CALL: marttiphpbb\usertopiccount\event\hard_update_listener->core_submit_post_end()

FILE: [ROOT]/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php
LINE: 158
CALL: call_user_func()

FILE: [ROOT]/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php
LINE: 46
CALL: Symfony\Component\EventDispatcher\EventDispatcher->doDispatch()

FILE: [ROOT]/phpbb/event/dispatcher.php
LINE: 60
CALL: Symfony\Component\EventDispatcher\EventDispatcher->dispatch()

FILE: [ROOT]/phpbb/event/dispatcher.php
LINE: 46
CALL: phpbb\event\dispatcher->dispatch()

FILE: [ROOT]/includes/functions_posting.php
LINE: 2458
CALL: phpbb\event\dispatcher->trigger_event()

FILE: [ROOT]/ext/elias/welcometopicrobot/event/listener.php
LINE: 168
CALL: submit_post()

FILE: [ROOT]/ext/elias/welcometopicrobot/event/listener.php
LINE: 74
CALL: elias\welcometopicrobot\event\listener->create_welcome_topic()

FILE: (not given by php)
LINE: (not given by php)
CALL: elias\welcometopicrobot\event\listener->send_topic()

FILE: [ROOT]/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php
LINE: 158
CALL: call_user_func()

FILE: [ROOT]/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php
LINE: 46
CALL: Symfony\Component\EventDispatcher\EventDispatcher->doDispatch()

FILE: [ROOT]/phpbb/event/dispatcher.php
LINE: 60
CALL: Symfony\Component\EventDispatcher\EventDispatcher->dispatch()

FILE: [ROOT]/phpbb/event/dispatcher.php
LINE: 46
CALL: phpbb\event\dispatcher->dispatch()

FILE: [ROOT]/phpbb/user.php
LINE: 184
CALL: phpbb\event\dispatcher->trigger_event()

FILE: [ROOT]/index.php
LINE: 29
CALL: phpbb\user->setup()

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Sun Jul 03, 2016 4:48 am
by SalazarAG
I will uninstall topic User count until the author again.

Without it everything is fine! Thank you for your help, David! :)

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Fri Jul 08, 2016 6:51 pm
by Mr_Richards_
Whenever someone on my forum tries to create a post on any section on my forums (Even ones that aren't directly connected to prefixed) are getting this error? I've even tried this myself on a test account and I got the same error.

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/ext/imkingdavid/prefixed/core/manager.php on line 432: Invalid argument supplied for foreach()
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 2423: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3925)
I don't appear to get this error when I'm on my administrator account and I make a post so I really don't know what's happening?

Any help would be greatly appreciated,

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Fri Jul 08, 2016 8:10 pm
by imkingdavid
Thanks Mr_Richards_. Can you please try the latest fix I pushed to the repository and let me know if that works?

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Fri Jul 08, 2016 9:00 pm
by Mr_Richards_
imkingdavid wrote:Thanks Mr_Richards_. Can you please try the latest fix I pushed to the repository and let me know if that works?
That appears to have fixed the issue! Thanks a ton!

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Fri Jul 29, 2016 11:07 am
by LukeWCS
@imkingdavid

Thanks for this ext. I want to test it in our tools and support forums, but if i create a new topic or change an existing one, there is nothing to choose (prefix). I added two prefixes with forum: 14 (Tools) and user group 5 (Admin).

Btw, it would be a good idea to explain in readme how to add several forums and groups to a prefix. I found this information here in this topic at page 7. ;)

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Tue Aug 02, 2016 8:48 pm
by imkingdavid
LukeWCS,

Thanks for the feedback. Right now the extension is a little bit incomplete because it is relying on a template event that hasn't yet been merged. In order to apply a prefix to a topic you'll need to manually edit the posting_editor.html template file to add in that template event. You can find the exact change that needs to be made by viewing the "Files changed" tab in this PR and going to the second changed file: https://github.com/phpbb/phpbb/pull/4371

As for setting the users and groups and forums allowed for individual prefixes, I am planning on making that a bit easier but haven't had a chance to really spend time on that yet. My goal is to have auto-complete for usernames and to use a multi-select box for the forums, and then for groups either auto-complete or another multi-select box. Basically I'd like to move away from having to use the user/group/forum IDs since that's not very intuitive. For now though, you're right, I should probably add a note somewhere about how to set those values correctly in the current version.

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Thu Aug 04, 2016 5:35 pm
by LukeWCS
Thanks, i will try it.

About your plans, sounds good. :)

Re: [BETA][3.1] [pre]fixed - Topic Prefixes extension

Posted: Mon Sep 12, 2016 1:48 pm
by imkingdavid
Great news - https://github.com/phpbb/phpbb/pull/4371 The pull request with the necessary template event has been merged, so it should be included as of versions:
3.1.10-RC1
3.2.0-RC2

I will bump up the minimum version requirements for this extension to reflect that. For any future testing, you should use one of those versions. (or latest dev branch of 3.1 or 3.2 on github).