collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 236
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

Author Topic: [Tip] Post Notifications on shoutbox  (Read 25772 times)

0 Members and 4 Guests are viewing this topic.

Offline 130860

  • Super Handsome Language Coordinator
  • Comrade
  • *
  • Posts: 1769
  • Gender: Male
  • You and I are not the same class of pirate!
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
[Tip] Post Notifications on shoutbox
« on: November 09, 2010, 02:39:49 PM »
well this tips is on nneonneo' shoutbox and AjaxChat  so I adapted to SimplePortal shoutbox :)

with this tip you can post notifications on your shout when a new topic is created, also, you can configure it so the notification appears only when a new topic is created on certain board you choose.

I only test it on a RC3 and RC4 board.

lets get started.

first open your  Sources/Post.php  and find:

Code: [Select]
notifyMembersBoard($notifyData);
and add after it:

Code: [Select]
global $user_info, $board, $scripturl, $boardName, $topic;

$smcFunc['db_insert']('',
'{db_prefix}sp_shouts',
array(
'id_shoutbox' => 'int',
'id_member' => 'int',
'member_name' => 'string',
'log_time' => 'int',
'body' => 'string',
),
array(
1,
$user_info['id'],
$user_info['name'],
time(),
'[color=red][b]New Topic: [url='.$scripturl . '?topic=' . $topic . '.new#new'.']'.html_entity_decode($_POST['subject']).'[/url][/b][/color]',
),
array('id_shout')
);


you can configure a little bit at this part:


1,    is the shoutbox ID, by default the first shoutbox you create has the ID 1, change it to yours.

Code: [Select]
'[color=red][b]New Topic: [url='.$scripturl . '?topic=' . $topic . '.new#new'.']'.html_entity_decode($_POST['subject']).'[/url][/b][/color]',
is the message to be posted, it will look like this:

Username: New Topic: topic name and url

the [color ] [/color] and [b ] [/b ]  tag will only work if you enable this tag in your shout's settings.

if you only want to show notifications from certain board only, use this:

$foros = array (1,2);  // where 1 and 2 are the ID of the boards you want to post notifications from

if (in_array($board, $foros))  // check if its the right board

it will look something like this:

Code: [Select]
$foros = array (1,2);


   if (in_array($board, $foros))
   {
global $user_info, $board, $scripturl, $boardName, $topic;

$smcFunc['db_insert']('',
'{db_prefix}sp_shouts',
array(
'id_shoutbox' => 'int',
'id_member' => 'int',
'member_name' => 'string',
'log_time' => 'int',
'body' => 'string',
),
array(
1,
$user_info['id'],
$user_info['name'],
time(),
'[color=red][b]New Topic: [url='.$scripturl . '?topic=' . $topic . '.new#new'.']'.html_entity_decode($_POST['subject']).'[/url][/b][/color]',
),
array('id_shout')
);
}


hope you find it useful, this is not my code, this is just an adaptation from nneonneo' shoutbox and AjaxChat  tips.





Offline Normally

  • Jr. Member
  • **
  • Posts: 53
  • Gender: Male
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Tip] Post Notifications on shoutbox
« Reply #1 on: November 14, 2010, 02:39:09 AM »
Great,

Is it possible to open the link in the same window?

Stef.
« Last Edit: November 14, 2010, 05:00:34 AM by Normally »

Offline grafitus

  • Comrade
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Re: [Tip] Post Notifications on shoutbox
« Reply #2 on: November 14, 2010, 03:34:45 AM »
Is it possible to open the link in the same window?
Code: (Find (I think that there are two)) [Select]
[url
Code: (Replace) [Select]
[iurl
my modsI don't reply support PMs. Please use support forums.

Offline Normally

  • Jr. Member
  • **
  • Posts: 53
  • Gender: Male
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Tip] Post Notifications on shoutbox
« Reply #3 on: November 14, 2010, 03:47:58 AM »
When i kake it like that it shows like this:

 Nieuw Topic: [i url=http://www.spirituelekaarten.nl/index.php?topic=592.new#new]Testen of het in de schreeuw komt.[/i][/color]

Here i maked i url, because here it works, but in the shoutbox i can not not click the link.

Offline grafitus

  • Comrade
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Re: [Tip] Post Notifications on shoutbox
« Reply #4 on: November 14, 2010, 04:28:44 AM »
Shouldn't be space between "i" and "url".
my modsI don't reply support PMs. Please use support forums.

Offline Normally

  • Jr. Member
  • **
  • Posts: 53
  • Gender: Male
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Tip] Post Notifications on shoutbox
« Reply #5 on: November 14, 2010, 04:35:13 AM »
I know, but otherwise i cannot show how it looks in the shoutbox.

Offline grafitus

  • Comrade
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Re: [Tip] Post Notifications on shoutbox
« Reply #6 on: November 14, 2010, 04:50:15 AM »
Oh, right! "iurl" not in allowed bbc tags. Let's add it:

./Sources/Subs-Portal.php
Code: (Find) [Select]
$row['allowed_bbc']
Code: (Replace) [Select]
$row['allowed_bbc'] . ',iurl'
my modsI don't reply support PMs. Please use support forums.

Offline Normally

  • Jr. Member
  • **
  • Posts: 53
  • Gender: Male
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Tip] Post Notifications on shoutbox
« Reply #7 on: November 14, 2010, 05:00:14 AM »
This works, thanks.

Stef.

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Tip] Post Notifications on shoutbox
« Reply #8 on: January 21, 2011, 12:37:33 PM »
Thank you, nice Tip!

How can i exclude some boards? this "aray"-thing is not working for me...

Offline 130860

  • Super Handsome Language Coordinator
  • Comrade
  • *
  • Posts: 1769
  • Gender: Male
  • You and I are not the same class of pirate!
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Tip] Post Notifications on shoutbox
« Reply #9 on: January 21, 2011, 02:58:45 PM »
can you post your full code and tell me the ID of the array you want to exclude.

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Tip] Post Notifications on shoutbox
« Reply #10 on: January 21, 2011, 03:13:21 PM »
well, the code i was using (in SMF2 RC2!) is:
Code: [Select]
$foros = array (4,5,40,68,60,61,19,14,15,53,50,56,51,62,63,64,65,13,16,43,69,70,71,72,73,58,59,17,66,67);
     
     
      if (in_array($board, $foros))
      {
global $user_info, $board, $scripturl, $boardName, $topic;
     
         $smcFunc['db_insert']('',
      '{db_prefix}sp_shouts',
      array(
         'id_shoutbox' => 'int',
         'id_member' => 'int',
         'member_name' => 'string',
         'log_time' => 'int',
         'body' => 'string',
      ),
      array(
         1,
         $user_info['id'],
         $user_info['name'],
         time(),
         '[color=red][b]Neues Thema: [url='.$scripturl . '?topic=' . $topic . '.new#new'.']'.html_entity_decode($_POST['subject']).'[/url][/b][/color]',
      ),
      array('id_shout')
   );
}

I have two boards, that i dont want to show in the shoutbox: board-ID number 42.0 and 54.0

Offline 130860

  • Super Handsome Language Coordinator
  • Comrade
  • *
  • Posts: 1769
  • Gender: Male
  • You and I are not the same class of pirate!
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Tip] Post Notifications on shoutbox
« Reply #11 on: January 21, 2011, 05:32:59 PM »
you don't need to listed all your boards,  try this code:

Code: [Select]
$foros = array (42,54);
     
     
      if (in_array($board, $foros))
  return;
 
  else
      {
global $user_info, $board, $scripturl, $boardName, $topic;
     
         $smcFunc['db_insert']('',
      '{db_prefix}sp_shouts',
      array(
         'id_shoutbox' => 'int',
         'id_member' => 'int',
         'member_name' => 'string',
         'log_time' => 'int',
         'body' => 'string',
      ),
      array(
         1,
         $user_info['id'],
         $user_info['name'],
         time(),
         '[color=red][b]Neues Thema: [url='.$scripturl . '?topic=' . $topic . '.new#new'.']'.html_entity_decode($_POST['subject']).'[/url][/b][/color]',
      ),
      array('id_shout')
   );
}


Offline Old Fossil

  • Beta Tester
  • *
  • Posts: 796
  • Gender: Male
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: [Tip] Post Notifications on shoutbox
« Reply #12 on: January 21, 2011, 06:30:44 PM »
Hey prisoner 130860

Have been watching this like a hawk.

Is there a way to post links so only certain membergroups can view it.

I have admin only boards and specific boards for certain groups ie subscribers and teenagers.
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Tip] Post Notifications on shoutbox
« Reply #13 on: January 22, 2011, 05:28:04 AM »
looks like it is (almost) function now.

When i write a new topic in the excluded boards, i have an error after submit: i dont see the new topic, only the head (menu) from the forum. in the error-log there is "could not load the main template"....
please, can you help?

Is there a way to show answers, too - not only the new topic?

Good work and a great tip.


Offline 130860

  • Super Handsome Language Coordinator
  • Comrade
  • *
  • Posts: 1769
  • Gender: Male
  • You and I are not the same class of pirate!
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Tip] Post Notifications on shoutbox
« Reply #14 on: January 22, 2011, 08:30:28 PM »
@Brack1  well, that will be  complicated, it is far better to create another shoutbox and give permisisons to this new shoutbox so only certain membergroups cann see it and shout on it.

 @Divecall  what is the exact error you gave?

attach your  Sources/Post.php  file.

and no, currently this tip is using a function in smf that is used only for new topics.

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Tip] Post Notifications on shoutbox
« Reply #15 on: January 24, 2011, 02:43:13 PM »
thanks 130860 for your help.

Here is the post.php

Offline 130860

  • Super Handsome Language Coordinator
  • Comrade
  • *
  • Posts: 1769
  • Gender: Male
  • You and I are not the same class of pirate!
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Tip] Post Notifications on shoutbox
« Reply #16 on: January 26, 2011, 12:21:20 PM »
Divecall  your file seems fine,  if you remove this tip the error goes away?

can you post the errors on your error log?

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Tip] Post Notifications on shoutbox
« Reply #17 on: January 26, 2011, 02:57:36 PM »
Well, my error-log is in german...

but you can see only, that is a Theme-error
and you can read:
http://localhost/myboard/index.php?action=post2;start=0;board=54
Cannot load the 'main' template

No File or number or something....

(like ever: File: [Path]/post.php), line: xxx - THERE IS NOTHING!)

Maybe the error is my XAMPP-Test-Area ???

Offline 130860

  • Super Handsome Language Coordinator
  • Comrade
  • *
  • Posts: 1769
  • Gender: Male
  • You and I are not the same class of pirate!
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Tip] Post Notifications on shoutbox
« Reply #18 on: January 26, 2011, 03:37:46 PM »
well, I need to know if the error is related with this tip,  the error still occurs  even if you take away the edits this tip make?

can you post the line you getting the error?  even if it is blank, it gave me an idea on where to look at.
 

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Tip] Post Notifications on shoutbox
« Reply #19 on: January 27, 2011, 10:13:47 AM »
Yes, the error is away, when i remove you tip.

Here is the screenshot: