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: 532
  • 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]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: Quick PM v1.0.4.1  (Read 35359 times)

0 Members and 2 Guests are viewing this topic.

Offline Kryzen

  • Localizer
  • Language
  • *
  • Posts: 826
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Quick PM v1.0.4.1
« on: August 09, 2011, 10:05:01 AM »
Quick PM
v1.0.4.1

Quick PM was originally created for Dream Portal, but I decided to port it to SP. This module allows users to send quick PM's. I would like to say thanks to SoLoGHoST, SlammedDime, Labradoodle-360, Ccbtimewiz, Phantomm, Miss all Sunday and DoctorMalboro. The current version is 1.0.4.1 and I hope to release v1.1 soon.

Installing is very simple. Just create a new PHP code block and use this code:
Code: [Select]
/**
Quick PM modification by Dr. Deejay
Module originally created for Dream Portal
Ported to SimplePortal by Dr. Deejay
Version 1.0.4.1
Thanks to: SoLoGHoST, SlammedDime, Labradoodle-360, Ccbtimewiz, Phantomm, Miss all Sunday and DoctorMalboro     
*/
global $txt, $buttons, $scripturl, $smcFunc, $context;


/*Config*/
$txt['quick_pm_block_not_allowed'] = 'You are not allowed to access this block';
$txt['quick_pm_block_default_user'] = 'Select user';
$txt['quick_pm_block_send'] = 'Send';

$query = $smcFunc['db_query']('', '
SELECT real_name, id_member
FROM {db_prefix}members
WHERE is_activated={int:activated}
ORDER BY real_name ASC',
array(
'activated' => 1,
)
);

$context['fastpm']['members'] = array();

while ($row = $smcFunc['db_fetch_assoc']($query))
{
$context['fastpm']['members'][$row['id_member']] = $row['real_name'];
}

$smcFunc['db_free_result']($query);

// Wait.. We DO have permissions for it, or don't we?
if (!allowedTo('pm_send'))
{
echo '',$txt['quick_pm_block_not_allowed'],'';
return;
}

// Are we allowed to view the memberlist? If yes, begin with the select box
echo '
<form action="#" method="post">
<select name="u" onchange="if (this.value) window.location.href=this.value">
<option value="0" selected="selected" disabled="disabled">',$txt['quick_pm_block_default_user'],'</option>';

foreach ($context['fastpm']['members'] as $key => $value)
echo '
<option value="', $scripturl, '?action=pm;sa=send;u=', $key, '">', $value, '</option>';

echo ' </select>
<input type="submit" value="',$txt['quick_pm_block_send'],'">
</form>';

// If we submitted the form, redirect to the messages section
if(isset($_POST['u']))
redirectexit('action=pm;sa=send;u=' . $_POST['u']);

Enjoy!
Dr. Deejay
« Last Edit: October 03, 2012, 05:45:07 AM by Dr. Deejay »

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: Quick PM v1.0.1
« Reply #1 on: August 09, 2011, 10:16:38 AM »
Looks cool :) 

the only thing is that if you have thousands of members, the select list will be huge :P


Offline Kryzen

  • Localizer
  • Language
  • *
  • Posts: 826
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Quick PM v1.0.1
« Reply #2 on: August 09, 2011, 10:26:53 AM »
Thanks 130850! :D
Yes, that's true lol :P Dunno how to solve that without letting it lose it's functionality, but I'll try and thanks for the comments :)

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: Quick PM v1.0.1
« Reply #3 on: August 10, 2011, 09:10:51 PM »
Well you could limit the list to show only the users buddies  or  use the 2.0 user auto-suggest ajax thing, the user then will just need to type the other user's name.

Offline Kryzen

  • Localizer
  • Language
  • *
  • Posts: 826
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Quick PM v1.0.1
« Reply #4 on: August 17, 2011, 09:13:35 AM »
Hmm great idea :) I'll change it in 1.1 ;)

Offline Shadow Queen

  • Jr. Member
  • **
  • Posts: 62
  • Gender: Female
    • My Kingdom
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Quick PM v1.0.1
« Reply #5 on: September 14, 2011, 02:11:59 PM »
Very nice.


Offline Kryzen

  • Localizer
  • Language
  • *
  • Posts: 826
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Quick PM v1.0.1
« Reply #6 on: September 14, 2011, 02:13:10 PM »
Thanks Shadow Queen :)

Offline Shadow Queen

  • Jr. Member
  • **
  • Posts: 62
  • Gender: Female
    • My Kingdom
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Quick PM v1.0.1
« Reply #7 on: September 14, 2011, 02:14:18 PM »
Your welcome :)

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Quick PM v1.0.1
« Reply #8 on: September 14, 2011, 03:17:51 PM »
Code: [Select]
if(isset($_POST['u']))
header("Location: ".$scripturl."?action=pm;sa=send;u=".$_POST['u']);

Can replace with:
Code: [Select]
if(isset($_POST['u']))
redirectexit('?action=pm;sa=send;u=' . $_POST['u']);

Offline Kryzen

  • Localizer
  • Language
  • *
  • Posts: 826
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Quick PM v1.0.1
« Reply #9 on: September 14, 2011, 03:22:52 PM »
Thanks for the tip ccbtimewiz, I'll change it in 1.0.2 (which will be released asap) :)

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Quick PM v1.0.1
« Reply #10 on: September 14, 2011, 04:19:27 PM »
Bug here:

Code: [Select]
if ($context['user']['is_guest'])
{
echo '</div>You are not allowed to access this module';
return;
}

Don't need a closing div if there was never an open div in the first place. Also, SimplePortal uses the term "Block", not "Module". In addition, you aren't checking if the user can even send a PM, just that if they're not a guest. Could make use of the allowedTo() function and use the appropriate permission.

Such as;

Code: [Select]
if (!allowedTo('send_pm'))
{
echo 'You are not allowed to access this block';
return;
}

Offline Kryzen

  • Localizer
  • Language
  • *
  • Posts: 826
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Quick PM v1.0.1
« Reply #11 on: September 15, 2011, 01:52:04 AM »
Thanks ccbtimewiz, I've fixed both issues :)

Offline phantomm

  • Translator
  • *
  • Posts: 406
  • Gender: Male
  • Smile, tomorrow will be worse...
    • Polish ElkArte community
  • SMF Version: None
  • Elkarte Version: 1.0.5
Re: Quick PM v1.0.2
« Reply #12 on: September 19, 2012, 11:47:43 AM »
one more fix, change:
Code: [Select]
if (!allowedTo('send_pm')) to
Code: [Select]
if (!allowedTo('pm_send'))
http://simpleportal.net/index.php?topic=11817.0

Offline boo2

  • Semi Newbie
  • *
  • Posts: 34
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Quick PM v1.0.2
« Reply #13 on: September 19, 2012, 01:37:16 PM »
I thought no one would reply to a thread that was a year old, but I guess I was wrong. Anyway Phantomm said I should make my suggestion here. Not expecting anything really, just a suggestion because I find this particular code very useful but might not if I had a huge number of members, so I wonder if there might not be another way to do this at that point that would work as well.

My suggestion was..

It would be great if someone could change this a bit and have it only show contacts of that persons buddy list, so that at some point the drop down doesn't become so long it's difficult to use. Hope that made sense. Or maybe there is another way to do it so that the drop down list of members would not become so long it would not longer be convenient.

It would also be nice if when you clicked on the members name in the drop down it immediately took you to the reply box before you even had to hit send.
Using SMF 2.0.2 and Simple portal 2.3.5

Offline FrizzleFried

  • Full Member
  • ***
  • Posts: 114
  • SMF Version: 2.0.5
  • SP Version: 2.3.5
Re: Quick PM v1.0.2
« Reply #14 on: September 20, 2012, 01:16:07 PM »
This code is nice... I used it at the bottom of my custom menu... however... the poor guy who is at #1 spot has his name showing at all time by default... that guy is geting a ton of PM's from the "idiot crowd"... any way to make a BLANK DEFAULT requiring someone click on the drop down menu to select a user?

Offline phantomm

  • Translator
  • *
  • Posts: 406
  • Gender: Male
  • Smile, tomorrow will be worse...
    • Polish ElkArte community
  • SMF Version: None
  • Elkarte Version: 1.0.5
Re: Quick PM v1.0.2
« Reply #15 on: September 21, 2012, 03:34:49 AM »
I replaced:
Code: [Select]
<form action="" method="post">
<select name="u">
to
Code: [Select]
<form action="" method="post">
<select name="u">
<option value="0" selected="selected">Select user</option>';

:)

Offline FrizzleFried

  • Full Member
  • ***
  • Posts: 114
  • SMF Version: 2.0.5
  • SP Version: 2.3.5
Re: Quick PM v1.0.2
« Reply #16 on: September 21, 2012, 10:56:25 AM »
Works perfect.  Thank you!

Offline boo2

  • Semi Newbie
  • *
  • Posts: 34
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Quick PM v1.0.2
« Reply #17 on: September 30, 2012, 02:16:18 PM »
I removed this for a while because i got tired of the error log filling up over it. Then yesterday I thought I would try it again, but removed the only other custom block for latest posts which doesn't throw any errors. Then I put this back as the only custom block and used it to pm just one person, then I checked the error logs and sure enough there they were. I can't believe a small bit of code like this could be so problematic. lol

Anyway doesn't look like anyone really cares about this mod but me at this point..

Heres the errors in case someone takes an interest one day. I sure would like it to work with out errors, works with them but I'm always nervousness when I have errors in admin.

Code: [Select]
/index.php?action=admin;area=portalblocks;sa=edit
2: fclose() expects parameter 1 to be resource, boolean given
File: Sources/Subs-PortalAdmin.php Line: 401

 
/index.php?action=admin;area=portalblocks;sa=edit
2: fwrite() expects parameter 1 to be resource, boolean given
File: Sources/Subs-PortalAdmin.php Line: 400
 

/index.php?action=admin;area=portalblocks;sa=edit
2: fopen(/public_html/sp_tmp_1349028364.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied
File: Sources/Subs-PortalAdmin.php Line: 399

And here is the code being used:

Code: [Select]
/**
Quick PM modification by Dr. Deejay
Module originally created for Dream Portal
Ported to SimplePortal by Dr. Deejay
Version 1.0.2
Thanks to: SoLoGHoST, SlammedDime, Labradoodle-360, Ccbtimewiz, Miss all Sunday and DoctorMalboro     
*/
global $txt, $buttons, $scripturl, $smcFunc, $context;

$query = $smcFunc['db_query']('', '
SELECT real_name, id_member
FROM {db_prefix}members
WHERE is_activated={int:activated}
ORDER BY real_name ASC',
array(
'activated' => 1,
)
);

$context['fastpm']['members'] = array();

while ($row = $smcFunc['db_fetch_assoc']($query))
{
$context['fastpm']['members'][$row['id_member']] = $row['real_name'];
}

$smcFunc['db_free_result']($query);

// Wait.. We DO have permissions for it, or don't we?
if (!allowedTo('pm_send'))
{
echo 'You are not allowed to access this block';
return;
}

// Are we allowed to view the memberlist? If yes, begin with the select box
echo '<form action="" method="post">
<select name="u">
<option value="0" selected="selected">Select user ....</option>';
foreach ($context['fastpm']['members'] as $key => $value)
echo ' <option value="', $key, '">', $value, '</option>';

echo ' </select>
<input type="submit" value="Send">
</form>';

// If we submitted the form, redirect to the messages section
if(isset($_POST['u']))
redirectexit('action=pm;sa=send;u=' . $_POST['u']);

« Last Edit: October 02, 2012, 02:03:13 PM by boo2 »
Using SMF 2.0.2 and Simple portal 2.3.5

Offline Kryzen

  • Localizer
  • Language
  • *
  • Posts: 826
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Quick PM v1.0.2
« Reply #18 on: October 01, 2012, 09:27:24 AM »
one more fix, change:
Code: [Select]
if (!allowedTo('send_pm')) to
Code: [Select]
if (!allowedTo('pm_send'))
http://simpleportal.net/index.php?topic=11817.0
Thank you for the fix, I'll release a 1.0.3 this afternoon. :)

Quote
It would be great if someone could change this a bit and have it only show contacts of that persons buddy list, so that at some point the drop down doesn't become so long it's difficult to use. Hope that made sense. Or maybe there is another way to do it so that the drop down list of members would not become so long it would not longer be convenient.

It would also be nice if when you clicked on the members name in the drop down it immediately took you to the reply box before you even had to hit send.
Thank you for the suggestions, I totally agree. I think only showing the buddies would be great, I'll take a look at that. Second idea would just take a few seconds to implement, so I'll add that too. Thanks again for the suggestions. :)

any way to make a BLANK DEFAULT requiring someone click on the drop down menu to select a user?
Sure, thanks for the suggestion, will do that too. ;D

Works perfect.  Thank you!
You're welcome. :)

Heres the errors in case someone takes an interest one day. I sure would like it to work with out errors, works with them but I'm always nervousness when I have errors in admin.

/index.php?action=admin;area=portalblocks;sa=edit
2: fclose() expects parameter 1 to be resource, boolean given
File: Sources/Subs-PortalAdmin.php Line: 401

 
/index.php?action=admin;area=portalblocks;sa=edit
2: fwrite() expects parameter 1 to be resource, boolean given
File: Sources/Subs-PortalAdmin.php Line: 400
 

/index.php?action=admin;area=portalblocks;sa=edit
2: fopen(/home/cafeweco/public_html/sp_tmp_1349028364.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied
File: Sources/Subs-PortalAdmin.php Line: 399
Weird, the code is not using fwrite, fopen or fclose, so I'll point the team to this topic. Thanks for the report, though. :)

Offline Kryzen

  • Localizer
  • Language
  • *
  • Posts: 826
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Quick PM v1.0.3
« Reply #19 on: October 01, 2012, 09:53:34 AM »
Version 1.0.3 released!
! Fixing wrong permission name (Thanks, Phantom!)
! Add default option (Thanks, Phantom!)
- Go to the send pm page automatically when you select a user

I couldn't find a way to show buddies only and I wanted to provide a patch as soon as possible, so I didn't include it in the 1.0.3 release. I'm still trying to find a way to show buddies only, though, but I'm afraid it could take some time.