Language: 
To browser these website, it's necessary to store cookies on your computer.
The cookies contain no personal information, they are required for program control.
  the storage of cookies while browsing this website, on Login and Register.

User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

Community



Donate

Donate for PortaMx !
Your donation is safe and helps support the issues and causes you care most about.

Stats

  • *Total Members: 4384
  • *Latest: scoobie

  • *Total Posts: 16083
  • *Total Topics: 2444
  • *Online Today: 4
  • *Most Online: 157
(27.08.09, 03:54:53)
  • *Users: 0
  • *Guests: 4
  • *Total: 4

Author Topic: Add new gif to topic where there is unread post(s)  (Read 124731 times)

0 Members and 0 Guests are viewing this topic.

Offline neverhurry

  • Sr. Member
  • ****
  • Posts: 285
  • Gender: Male
  • PortaMX fan
Hi, since I created inside Portamx a Mulltiple boardnews block, I would like to add a new gif to topic (title) where there is unread post(s). My php knowledge is poor but I grabbed something from SMF codes and here is my thinking how to approad this, I hope I can be advised by any of you, thanks.

1. open .../Source/Portamx/boardnewsmult.php
2. in line 84 add:
Code: [Select]
IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
        IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_modified AS is_read,
        IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ', SUBSTRING(m.body, 1, 384) AS body, m.smileys_enabled, m.icon

3. find
 
Code: [Select]
WHERE b.id_board IN ({array_int:boards}) AND {query_wanna_see_board}'.
and add before it:

Code: [Select]
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (!$user_info['is_guest'] ? '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' : '') . '

4. find
Code: [Select]
'views' => $row['num_views'],
and add after:

Code: [Select]
'new' => !empty($row['is_read']),
            'is_new' => empty($row['is_read']),
'new_from' => $row['new_from'],

5. find

Code: [Select]
<h4 id="pmx'.$this->cfg['id'].'bnmpos'. $post['message_id'] .'" class="'. $this->cfg['config']['visuals']['postheader'] .' catbg_grid">
'. $post['icon'] .'<span class="normaltext cat_msg_title"><a href="' . $scripturl . '?topic=' . $post['id'] . '.0">'. $post['subject'] .'</a></span>
</h4>

and change it to

Code: [Select]
<h4 id="pmx'.$this->cfg['id'].'bnmpos'. $post['message_id'] .'" class="'. $this->cfg['config']['visuals']['postheader'] .' catbg_grid">
'. $post['icon'] .'<span class="normaltext cat_msg_title"><a href="' . $scripturl . '?topic=' . $post['id'] . '.0">'. $post['subject'] .'</a>', !$post['is_new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '</span>

</h4>


I thought it should work, cause they look logical to me, but unfortunately it doesn't work, it got an error says that there is no current_member data in the database.

Thank you very much to comment and advise!




Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 5686
  • Gender: Female
Re: Add new gif to topic where there is unread post(s)
« Reply #1 on: 26.04.11, 21:26:02 »
if you add a variable in the query, so you have that also insert in the vars array ...
Many are stubborn in relation to the path, a few in relation to the target.

Offline neverhurry

  • Sr. Member
  • ****
  • Posts: 285
  • Gender: Male
  • PortaMX fan
Re: Add new gif to topic where there is unread post(s)
« Reply #2 on: 27.04.11, 15:57:34 »
if you add a variable in the query, so you have that also insert in the vars array ...

Fel, thanks. Do you mean the vars 'is_read' and 'new_from'? Which I do insert in the array ...

Code: [Select]
'new' => !empty($row['is_read']),
'is_new' => empty($row['is_read']),
'new_from' => $row['new_from'],

I grabbed these codes from SMF's subs_recent.php (which is before SMF 2.0 RC3), but the comment there says that these code “// Retained for compatibility - is technically incorrect!”, so probably here was the problem that the modification doesn't work. Is it so?

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 5686
  • Gender: Female
Re: Add new gif to topic where there is unread post(s)
« Reply #3 on: 27.04.11, 18:16:57 »
I mean this: {int:current_member}
for this you have to add the value in the query var array:
Code: [Select]
array(
'boards' => $boards,
'is_approved' => 1
)

change that to:
Code: [Select]
array(
'boards' => $boards,
'is_approved' => 1,
'current_member' => $user_info['id'],
)
Many are stubborn in relation to the path, a few in relation to the target.

Offline neverhurry

  • Sr. Member
  • ****
  • Posts: 285
  • Gender: Male
  • PortaMX fan
Re: Add new gif to topic where there is unread post(s)
« Reply #4 on: 15.05.11, 10:10:08 »
I mean this: {int:current_member}
for this you have to add the value in the query var array:
Code: [Select]
array(
'boards' => $boards,
'is_approved' => 1
)

change that to:
Code: [Select]
array(
'boards' => $boards,
'is_approved' => 1,
'current_member' => $user_info['id'],
)

Thanks, that did the trick. I added 'current_member' => $user_info['id'], to the code and that works.
I hope Portamx can add this small but useful function to next release. Have a nice Sunday!