Page 14 of 17

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

Posted: Fri Oct 28, 2016 3:56 am
by Lunaus
Alright, works great!

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

Posted: Fri Oct 28, 2016 7:54 am
by Hartenheer
Nice extension, I hope he will soon accommodate existing forums.

I use now trader-master, has been abandoned.
afraid not work in 3.2

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

Posted: Sat Oct 29, 2016 5:36 pm
by Hartenheer
I have tried installing on test forum

For a beginner impossible
understand little of the explanation

I download programs, and Extensions Manager read this

Getting the latest version failed.
The requested file, prefix.json, could not be found

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

Posted: Mon Oct 31, 2016 5:04 am
by SalazarAG
Hi imkingdavid ! =)


I know you do not intend to add this feature, but you can help me to add myself? Please.


I refer to the brackets [ and ] which lie between the prefix in the page title in the browser


I know I could add "[" and "]" to create a prefix but use black theme is showing the brackets and I just wanted them in the page title. I found this part of the code in listener.php, I think it is here that change. If it is not too difficult, you can help me with this?

Code: Select all

/**
	 * Get the parsed prefix for the current topic, output it to the template
	 * Also gets a plaintext version for the browser page title
	 *
	 * @param Event $event Event object
	 * @return null
	 */
	public function get_viewtopic_topic_prefix($event)
	{
		$event['page_title'] = $this->load_prefixes_topic($event, 'topic_data') . $event['page_title'];
	}


Good evening!

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

Posted: Mon Nov 07, 2016 4:15 am
by imkingdavid
SalazarAG,

Yes, if you change the line to look like this it should work:

Code: Select all

$event['page_title'] = '[' . $this->load_prefixes_topic($event, 'topic_data') . ']' . $event['page_title'];
Hartenheer wrote:I have tried installing on test forum

For a beginner impossible
understand little of the explanation

I download programs, and Extensions Manager read this

Getting the latest version failed.
The requested file, prefix.json, could not be found
What version of phpBB are you using? I have no trouble installing the extension.

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

Posted: Mon Nov 07, 2016 8:37 am
by Hartenheer
Hartenheer wrote:I have tried installing on test forum

For a beginner impossible
understand little of the explanation

I download programs, and Extensions Manager read this

Getting the latest version failed.
The requested file, prefix.json, could not be found
What version of phpBB are you using? I have no trouble installing the extension.[/quote]


I use 5.6.23

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

Posted: Mon Nov 07, 2016 9:27 am
by SalazarAG
imkingdavid wrote:SalazarAG,

Yes, if you change the line to look like this it should work:

Code: Select all

$event['page_title'] = '[' . $this->load_prefixes_topic($event, 'topic_data') . ']' . $event['page_title'];
Hartenheer wrote:I have tried installing on test forum

For a beginner impossible
understand little of the explanation

I download programs, and Extensions Manager read this

Getting the latest version failed.
The requested file, prefix.json, could not be found
What version of phpBB are you using? I have no trouble installing the extension.
Hi, David!

Thanks a lot for the help!

It worked.

Only one small thing I noticed: It is a blank space between the last bracket "]", see:

Image

It has some way to let the two brackets together the text prefix?

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

Posted: Mon Nov 07, 2016 6:46 pm
by Hartenheer
I install, activate
Then see nothing

It is difficult to work

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

Posted: Tue Nov 08, 2016 7:23 pm
by imkingdavid
@SalazarAG - It's because of this line: https://github.com/imkingdavid/prefixed ... r.php#L255

You may be able to fix it by changing the code block from 246-256 in that file to this:

Code: Select all

		$prefixes_array = array();
		foreach ($topic_prefixes as $instance)
		{
			$vars = [];
			// A URL to a viewforum view filtered by the prefix
			if ($this->request->variable('f', 0))
			{
				$vars['URL'] = append_sid($this->root_path . 'viewforum.php', ['f' => $this->request->variable('f', 0), 'prefix' => $instance['prefix']]);
			}
			$prefixes_array[] = $instance->parse($block, $vars, $return_parsed) . ' ';
		}
		$return_string = implode(' ', $prefixes_array);
I'll try to remember to fix that in the next commit.
Hartenheer wrote:I install, activate
Then see nothing

It is difficult to work
If you go to the ACP and look under the Posting tab, you don't see anything about Topix Prefixes on the left navigation?

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

Posted: Tue Nov 08, 2016 7:34 pm
by Hartenheer
No idea how to run this extension.

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

Posted: Wed Nov 09, 2016 12:06 pm
by SalazarAG
imkingdavid wrote:@SalazarAG - It's because of this line: https://github.com/imkingdavid/prefixed ... r.php#L255

You may be able to fix it by changing the code block from 246-256 in that file to this:

Code: Select all

		$prefixes_array = array();
		foreach ($topic_prefixes as $instance)
		{
			$vars = [];
			// A URL to a viewforum view filtered by the prefix
			if ($this->request->variable('f', 0))
			{
				$vars['URL'] = append_sid($this->root_path . 'viewforum.php', ['f' => $this->request->variable('f', 0), 'prefix' => $instance['prefix']]);
			}
			$prefixes_array[] = $instance->parse($block, $vars, $return_parsed) . ' ';
		}
		$return_string = implode(' ', $prefixes_array);
I'll try to remember to fix that in the next commit.
Hartenheer wrote:I install, activate
Then see nothing

It is difficult to work
If you go to the ACP and look under the Posting tab, you don't see anything about Topix Prefixes on the left navigation?

David worked perfectly. :)

But now something strange has come up kkkkkkkk Now, on topics that do not have prefixes, the brackets appear anyway, see:

Image

This topic has no prefix assigned, so the brackets should not appear.


Hahaha how hard this

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

Posted: Wed Nov 09, 2016 3:13 pm
by imkingdavid
Oh, my mistake.

For this code:
$event['page_title'] = '[' . $this->load_prefixes_topic($event, 'topic_data') . ']' . $event['page_title'];

You should change it to this:

Code: Select all

$topic_prefixes = $this->load_prefixes_topic($event, 'topic_data');
if (!empty($topic_prefixes))
{
    $event['page_title'] = '[' . $topic_prefixes . ']' . $event['page_title'];
}
Let me know if that works.

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

Posted: Wed Nov 09, 2016 3:20 pm
by Hartenheer
I give up.
Deleted extension on my test forum.
Do not understand how it works

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

Posted: Wed Nov 09, 2016 3:51 pm
by SalazarAG
imkingdavid wrote:Oh, my mistake.

For this code:
$event['page_title'] = '[' . $this->load_prefixes_topic($event, 'topic_data') . ']' . $event['page_title'];

You should change it to this:

Code: Select all

$topic_prefixes = $this->load_prefixes_topic($event, 'topic_data');
if (!empty($topic_prefixes))
{
    $event['page_title'] = '[' . $topic_prefixes . ']' . $event['page_title'];
}
Let me know if that works.
It worked!!!

Very, very, thank you David :)

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

Posted: Wed Nov 09, 2016 5:19 pm
by SalazarAG
Hartenheer wrote:I give up.
Deleted extension on my test forum.
Do not understand how it works
It's simple

You install, then in the Posting tab you will find below "Manage Prefixes". You click on it in "New Prefix".

Image

Then you put the prefix, prefix name, id (number that is at the end of the url) of the forum, id of the groups that can use and id of the user that can use.

Image