News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Help me write this code...

Started by Biology Forums, March 09, 2012, 06:33:30 PM

Previous topic - Next topic

IchBin™

If you look at the code snippet I first posted you'll see this:

Code: (add above the code you posted) :)
IchBin™        TinyPortal

Biology Forums

Quote from: Labradoodle-360 on March 12, 2012, 05:21:02 PM
You have to add it above the other code you need to modify.
// 'Print' the topic info.
$context['topics'][$row['ID_TOPIC']] = array(


I did, and I get this crazy error:

Please try again. If you come back to this error screen, report the error to an administrator.

It won't display the messages in the messageindex anymore :-\

Matthew K.

Go ahead and attach your MessageIndex file WITH the code you added.


Matthew K.


Biology Forums

Quote from: Labradoodle-360 on March 12, 2012, 06:14:02 PM
Try the attached file :)

Thanks Labradoodle-360,

This time there was no error, but when I set:

$mygroups = array(1,3);

To: $mygroups = array(2);

Which is the group I want to show red links, no red links are being shown, they are all blue still :(

Matthew K.


Biology Forums

Quote from: Labradoodle-360 on March 12, 2012, 06:31:19 PM
Try attached.

Labradoodle-360, I know you're a smart guy, but after I tell you this you'll probably run out of steam:

It didn't work still :-\ Same result as before - links are showing as normal, not read.

Matthew K.

How about a link to your forum, and an admin account.


Matthew K.



Marcus Forsberg

Any update on this? A quick look at MessageIndex.php tells me that the style is being applied to the member's name, and not the topic title as the OP requested.
Also, what is with the $groups array at all? It makes no sense to use an array when there's always just a single row to think about. Not to mention that this extra query could probably be merged with a previous one. A single line of code could do all of this very easily.

Biology Forums

Quote from: Marcus Forsberg on April 04, 2012, 08:03:38 AM
Any update on this? A quick look at MessageIndex.php tells me that the style is being applied to the member's name, and not the topic title as the OP requested.
Also, what is with the $groups array at all? It makes no sense to use an array when there's always just a single row to think about. Not to mention that this extra query could probably be merged with a previous one. A single line of code could do all of this very easily.

Marcus, a lot of people have tried and failed. If you can develop a code that I can insert into the messageindex.php, I'd be pretty thankful.

emanuele

Search for:
Code (find) Select
mf.smileysEnabled AS firstSmileys
and replace with
Code (replace with) Select
mf.smileysEnabled AS firstSmileys, memf.ID_GROUP

then:
Code (find) Select
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['firstSubject'] . '</a>'
Code (replace with) Select
'link' => '<a ' . (in_array($row['ID_GROUP'], array(1)) ? ' style="color: red"' : '' ) . 'href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['firstSubject'] . '</a>'

Not sure if it is what you are looking for, let me know. ;)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Marcus Forsberg

Now *that's* what I'm talking about.

Biology Forums

Quote from: Marcus Forsberg on April 04, 2012, 06:32:00 PM
Now *that's* what I'm talking about.
It still didn't work, links are showing their normal color, and I parsed it correctly. :-\

Matthew K.

Well even with that code, why use in_array();, why MAKE it an array if it's a single value...?

emanuele

Quote from: Liam_michael on April 04, 2012, 09:10:07 PM
Quote from: Marcus Forsberg on April 04, 2012, 06:32:00 PM
Now *that's* what I'm talking about.
It still didn't work, links are showing their normal color, and I parsed it correctly. :-\
The group you are looking for is the primary or an additional?
I worked in my test forum...

Quote from: Labradoodle-360 on April 04, 2012, 09:49:00 PM
Well even with that code, why use in_array();, why MAKE it an array if it's a single value...?
Because the original question was:
Quote from: Liam_michael on March 09, 2012, 06:33:30 PM
If the person who started the topic is in group 15 or 21, show the topic title in red.
so so extend ad in_array it's easier than put another $row == 2. ;D


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Matthew K.

If he does intend on adding more groups, definitely.

Advertisement: