Skip to main content
Topic: [ADDON][beta] Topic Prefix (Read 27395 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: [ADDON][beta] Topic Prefix

Reply #76
Another bug, duplicate prefixes, to reproduce it:
- choose a topic which already have a prefix
- in topc view, select the topic and choose Add prefix, then select a different prefix
- that topic will have now two prefixes into database
- if you try to edit the topic and choose a prefix you will get a database error:
Code: [Select]
Duplicate entry '1-14638' for key 'id_topic_prefix'
File: /public/sources/subs/TopicPrefixTcCRUD.class.php
Riga: 85

Nota: la versione del tuo database è 1.1.1.
sorry for my bad english

Re: [ADDON][beta] Topic Prefix

Reply #77
https://github.com/emanuele45/TopicPrefix/commit/1914371195520762b3e49453120f6635ed0f5a52
this solves the error in elkarte log, but the prefix disappear if you try to edit the first post
yeah... it was not !empty, but just empty. *facepalm*

Another bug, duplicate prefixes, to reproduce it:
- choose a topic which already have a prefix
- in topc view, select the topic and choose Add prefix, then select a different prefix
I'm a bit lost in that step... where exactly?
Bugs creator.
Features destroyer.
Template killer.


Re: [ADDON][beta] Topic Prefix

Reply #79
Ooohh... that was something I didn't notice it was added and I did not merge into my branch.
I'm playing around with it a bit trying to figure out how to move that code out of MessageIndex.controller.php.
In the meantime, instead of the code:
Code: [Select]
						if (!empty($prefix))
{
$db = database();
$db->insert('ignore',
'{db_prefix}topic_prefix',
array(
'id_prefix' => 'int',
'id_topic' => 'int',
),
array(
$prefix,
$row['id_topic']
),
array('id_prefix', 'id_topic')
);
}

You should be able to use something like this:
Code: [Select]
$prefix = new TopicPrefix();
$prefix_id = (int) $_REQUEST['prefix'];
foreach ($_REQUEST['topics'] as $topic)
{
$prefix->updateTopicPrefix($topic, $prefix_id);
}

Not tested, so it may be broken... okay, let's face reality: knowing myself it is broken.
Bugs creator.
Features destroyer.
Template killer.

Re: [ADDON][beta] Topic Prefix

Reply #80
okay, let's face reality: knowing myself it is broken.
 you're wrong this time, :P  your code seems to work, I did the same procedure mentioned above, the prefix is changed without adding a duplicate into the database. I'll test it better in the next days, probably something else will pop out. :D
sorry for my bad english

Re: [ADDON][beta] Topic Prefix

Reply #81
Heck, that's embarrassing...
Bugs creator.
Features destroyer.
Template killer.

Re: [ADDON][beta] Topic Prefix

Reply #82
Okay, updated the repo with some code that should allow to have the quick-moderation without requiring code edits.
https://github.com/emanuele45/TopicPrefix/
IIRC it's enough to download and apply, but well, usual disclaimer applies. xD
Bugs creator.
Features destroyer.
Template killer.

Re: [ADDON][beta] Topic Prefix

Reply #83
@emanuele‍ the version from github is unusable, it has different bugs that Spuds already corrected, please see the latest version posted here https://www.elkarte.net/community/index.php?topic=1424.msg40565#msg40565

I just installed on a test forum the version from github (clean forum with 1.1.7 patch applied), here is what I found:

I have 1 board with 3 prefixes, just click on prefix, prefix2, prefix3 and got this error:
Too few arguments to function TopicPrefix_PxCRUD::count(), 1 passed in sources/subs/TopicPrefixPxCRUD.class.php on line 38 and exactly 2 expected

There is no quick way to add a prefix here:
X

If you click on a prefix that it is not applied to any topic, the prefix list does not have any css applied (in my case p3)
X X

Probably there are more bugs

edit
yep, another one: if I try to edit a topic using the full editor and I set up a prefix, I get this error:
An Error Has Occurred
The database value you're trying to insert does not exist: new_prefix

    Type of error: Critical

    The database value you're trying to insert does not exist: new_prefix
    Function: runQuery
    index.php?action=post2;start=0;msg=4;c120S8EG=64c120uWgzEiG4oG71d9vXmwSJ0wSIEg;board=1
    File:/sources/subs/TopicPrefixTcCRUD.class.php
    Line: 185
sorry for my bad english

Re: [ADDON][beta] Topic Prefix

Reply #84
No guarantees but I think all the changes I made are here: https://github.com/Spuds/Elk_Topic_Prefix/commits/master I thought I pr'ed those back, but that was a year ago so who knows!
Be safe, Be kind, Happy Programing

Re: [ADDON][beta] Topic Prefix

Reply #85
@emanuele‍ the version from github is unusable, it has different bugs that Spuds already corrected, please see the latest version posted here https://www.elkarte.net/community/index.php?topic=1424.msg40565#msg40565
@radu81 the version on github includes anything that is in Spuds' repo (I ported it at the end of December).

I have 1 board with 3 prefixes, just click on prefix, prefix2, prefix3 and got this error:
Too few arguments to function TopicPrefix_PxCRUD::count(), 1 passed in sources/subs/TopicPrefixPxCRUD.class.php on line 38 and exactly 2 expected
Considering:
https://github.com/emanuele45/TopicPrefix/blob/master/Sources/subs/TopicPrefixPxCRUD.class.php#L38
there is no "count" at line 38 of the current version, I have the feeling you are using an older package for some reason.

If you click on a prefix that it is not applied to any topic, the prefix list does not have any css applied (in my case p3)
[attach type=thumb]6895[/attach] [attach type=thumb]6897[/attach]



Probably there are more bugs
Very well possible.

edit
yep, another one: if I try to edit a topic using the full editor and I set up a prefix, I get this error:
An Error Has Occurred
The database value you're trying to insert does not exist: new_prefix

    Type of error: Critical

    The database value you're trying to insert does not exist: new_prefix
    Function: runQuery
    index.php?action=post2;start=0;msg=4;c120S8EG=64c120uWgzEiG4oG71d9vXmwSJ0wSIEg;board=1
    File:/sources/subs/TopicPrefixTcCRUD.class.php
    Line: 185
And again, line 185 has not that code:
https://github.com/emanuele45/TopicPrefix/blob/master/Sources/subs/TopicPrefixPxCRUD.class.php#L185

Guess this image may help:


:P
Bugs creator.
Features destroyer.
Template killer.

Re: [ADDON][beta] Topic Prefix

Reply #86
Sorry Ema, github is not for me, guess what version I downloaded? The one with a big red X :-X :-[
https://github.com/emanuele45/TopicPrefix/releases/download/v0.0.3/TopicsPrefix_0-0-3.zip


I just downloaded the correct version, seems to work, I will also install it on my live site. For now I only see an undefined error in elkarte log:
  • Type of error: Undefined
  • /index.php?action=admin;area=logs;sa=errorlog;desc;filter=message;value=Tm90aWNlOiBVbmRlZmluZWQgaW5kZXg6IGRlbnlcX2JvYXJkc1xfYWNjZXNz
  • Notice: Undefined index: deny_boards_access
  • File: /themes/default/TopicPrefix.template.php
  • Line: 80

sorry for my bad english

 

Re: [ADDON][beta] Topic Prefix

Reply #87
Sorry if I insist on this, but is there a way to see the topic prefix on "New Posts" and "New Replies" lists?
sorry for my bad english