41
Jack404
Re: XOOPS2: Private Messages Question
  • 2003/8/21 2:19

  • Jack404

  • Just popping in

  • Posts: 56

  • Since: 2003/5/16


I'm a bit confused, but thanks for all the help!

I saw that bit of code, and that's what got me to use what I did in the URL. I saw that it was looking for "message" in the URL, so I added that, but that didn't let the message show up in the message box.

Could it be that the message is there, but just not being added to the textbox and made visible?



42
Jack404
Re: XOOPS2: Private Messages Question
  • 2003/8/20 21:44

  • Jack404

  • Just popping in

  • Posts: 56

  • Since: 2003/5/16


Contents of pmlite.php:

$xoopsOption['pagetype'] = "pmsg";

include 
"mainfile.php";
$reply = !empty($HTTP_GET_VARS['reply']) ? 0;
$send = !empty($HTTP_GET_VARS['send']) ? 0;
$send2 = !empty($HTTP_GET_VARS['send2']) ? 0;
$to_userid = !empty($HTTP_GET_VARS['to_userid']) ? intval($HTTP_GET_VARS['to_userid']) : 0;
//added
$msg_text = !empty($HTTP_GET_VARS['msg_text']) ? intval($HTTP_GET_VARS['msg_text']) : 0;
//end added
$msg_id = !empty($HTTP_GET_VARS['msg_id']) ? intval($HTTP_GET_VARS['msg_id']) : 0;
if ( empty(
$HTTP_GET_VARS['refresh'] ) && isset($HTTP_POST_VARS['op']) && $HTTP_POST_VARS['op'] != "submit" ) {
        
$jump "pmlite.php?refresh=".time()."";
        if ( 
$send == ) {
                
$jump .= "&send=".$send."";
        } elseif ( 
$send2 == ) {
                
$jump .= "&send2=".$send2."&to_userid=".$to_userid."";
        } elseif ( 
$reply == ) {
                
$jump .= "&reply=".$reply."&msg_id=".$msg_id."";
        } else {
        }
        echo 
"<html><head><meta http-equiv='Refresh' content='0; url=".$jump."' /></head><body></body></html>";
        exit();
}
xoops_header();
if (
$xoopsUser) {
        
$myts =& MyTextSanitizer::getInstance();
        if (isset(
$HTTP_POST_VARS['op']) && $HTTP_POST_VARS['op'] == "submit") {
                
$res $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("users")." WHERE uid=".intval($HTTP_POST_VARS['to_userid'])."");
                list(
$count) = $xoopsDB->fetchRow($res);
                if (
$count != 1) {
                        echo 
"<br /><br /><div><h4>"._PM_USERNOEXIST."<br />";
                        echo 
_PM_PLZTRYAGAIN."</h4><br />";
                            echo 
"[ <a href='javascript:history.go(-1)'>"._PM_GOBACK."</a> ]</div>";
                } else {
                        
$pm_handler =& xoops_gethandler('privmessage');
                        
$pm =& $pm_handler->create();
                        
$pm->setVar("subject"$HTTP_POST_VARS['subject']);
                        
$pm->setVar("msg_text"$HTTP_POST_VARS['message']);
                        
$pm->setVar("to_userid"$HTTP_POST_VARS['to_userid']);
                        
$pm->setVar("from_userid"$xoopsUser->getVar("uid"));
                        if (!
$pm_handler->insert($pm)) {
                                echo 
$pm->getHtmlErrors();
                                echo 
"<br /><a href='javascript:history.go(-1)'>"._PM_GOBACK."</a>";
                        } else {
                                echo 
"<br /><br /><div style='text-align:center;'><h4>"._PM_MESSAGEPOSTED."</h4><br /><a href="javascript:window.opener.location='".XOOPS_URL."/viewpmsg.php';window.close();">"._PM_CLICKHERE."</a><br /><br /><a href="javascript:window.close();">"._PM_ORCLOSEWINDOW."</a></div>";
                        }
                }
        } elseif (
$reply == || $send == || $send2 == 1) {
                include 
XOOPS_ROOT_PATH."/include/xoopscodes.php";
                if (
$reply == 1) {
                        
$pm_handler =& xoops_gethandler('privmessage');
                        
$pm =& $pm_handler->get($msg_id);
                        if (
$pm->getVar("to_userid") == $xoopsUser->getVar('uid')) {
                                
$pm_uname XoopsUser::getUnameFromId($pm->getVar("from_userid"));
                
$message  "[quote]n";
                                
$message .= sprintf(_PM_USERWROTE,$pm_uname);
                                
$message .= "n".$pm->getVar("msg_text""E")."n[/quote]";
                        } else {
                                unset(
$pm);
                                
$reply $send2 0;
                        }
                }
                echo 
"<form action='pmlite.php' method='post' name='coolsus'>n";
                echo 
"<table width='300' align='center' class='outer'><tr><td class='head' width='25%'>"._PM_TO."</td>";
                if ( 
$reply == ) {
                        echo 
"<td class='even'><input type='hidden' name='to_userid' value='".$pm->getVar("from_userid")."' />".$pm_uname."</td>";
                } elseif ( 
$send2 == ) {
                        
$to_username XoopsUser::getUnameFromId($to_userid);
                        echo 
"<td class='even'><input type='hidden' name='to_userid' value='".$to_userid."' />".$to_username."</td>";
                } else {
                        echo 
"<td class='even'><select name='to_userid'>";
                        
$result $xoopsDB->query("SELECT uid, uname FROM ".$xoopsDB->prefix("users")." WHERE level > 0 ORDER BY uname");
            while ( list(
$ftouid$ftouname) = $xoopsDB->fetchRow($result) ) {
                                echo 
"<option value='".$ftouid."'>".$myts->makeTboxData4Show($ftouname)."</option>";
                        }
            echo 
"</select></td>";
        }
        echo 
"</tr>";
        echo 
"<tr><td class='head' width='25%'>"._PM_SUBJECTC."</td>";
                if ( 
$reply == ) {
                        
$subject $pm->getVar('subject''E');
                        if (!
preg_match("/^Re:/i",$subject)) {
                                
$subject 'Re: '.$subject;
                        }
                        echo 
"<td class='even'><input type='text' name='subject' value='".$subject."' size='30' maxlength='100' /></td>";
                } else {
                        echo 
"<td class='even'><input type='text' name='subject' value='".$subject."' size='30' maxlength='100' /></td>";
                }
                echo 
"</tr>";
        echo 
"<tr valign='top'><td class='head' width='25%'>"._PM_MESSAGEC."</td>";
                echo 
"<td class='even'>";
                
xoopsCodeTarea("message",37,8);
                
xoopsSmilies("message");
                echo 
"</td>";
                echo 
"</tr>";
        echo 
"<tr><td class='head'>&nbsp;</td><td class='even'>
                <input type='hidden' name='op' value='submit' />
                <input type='submit' class='formButton' name='submit' value='"
._PM_SUBMIT."' />&nbsp;
                <input type='reset' class='formButton' value='"
._PM_CLEAR."' />
                &nbsp;<input type='button' class='formButton' name='cancel' value='"
._PM_CANCELSEND."' onclick='javascript:window.close();' />
                </td></tr></table>n"
;
                   echo 
"</form>n";
        }
} else {
        echo 
_PM_SORRY."<br /><br /><a href='".XOOPS_URL."/register.php'>"._PM_REGISTERNOW."</a>.";
}

xoops_footer();


What would I need to add? I'm not too great at hacking, and I think this could be a nice addition to the newBB module, so anyone who could help would benefit the multitudes



43
Jack404
XOOPS2: Private Messages Question
  • 2003/8/20 20:37

  • Jack404

  • Just popping in

  • Posts: 56

  • Since: 2003/5/16


I'm currently working on a "Report This Post" template hack for the X2 NewBB module, and my goal is for a private message to be sent to the webmaster (or, more ideally, the moderator of the forum, but I can't think of how I'd do this) regarding the post that was reported.

My problem is that I cannot figure out how to insert text into the Subject and Message parts of the Private Message by using a link.

For instance, as a test, I wanted the Private Message window to open to be sent to the Webmaster (always uid 1, or it is in my case) with the subject "Report" and the message body saying "testing123". This is the link I am using:

http://www.mysite.url/pmlite.php?send2=1&to_userid=1&subject=report&message=testing123

However, I open the window using the link and nothing is in the subject or message boxes. What am I doing wrong? Do I need to hack the pmlite.php file in order for this to work, or just tweak the URL I'm using?

Any help would be IMMENSELY appreciated!



44
Jack404
Re: XOOPS2 NewBB: Give moderators right to edit and delete posts
  • 2003/7/11 14:36

  • Jack404

  • Just popping in

  • Posts: 56

  • Since: 2003/5/16


Err, how do I say it...

Not all my Moderators are computer savvy, so I like to keep their interfaces as simple as possible. I completely trust my Moderators, but they could get overwhelmed with the Administration menu followed by all the options for Forum Admin; I don't want them to go through all there and end up deleting the entire forum when they are trying to lock a thread.

Maybe that better explains it.

Another reasons is that I was foolish once and one of my Moderators became upset and started to delete forums like crazy; I don't trust people nearly as much as I used to, so you'll have to forgive me for not granting them sitewide admin privs to the forums.



45
Jack404
Re: XOOPS2 NewBB: Give moderators right to edit and delete posts
  • 2003/7/11 14:26

  • Jack404

  • Just popping in

  • Posts: 56

  • Since: 2003/5/16


In your plan, however, the Moderators have complete NewBB admin privs, which means they can add and delete forums. I really don't want to give that power out to all my moderators, so my template edit works much better for me



46
Jack404
XOOPS2 NewBB: Give moderators right to edit and delete posts
  • 2003/7/11 13:34

  • Jack404

  • Just popping in

  • Posts: 56

  • Since: 2003/5/16


Firstly, find this line in your newbb_thread.html template:

Quote:

<{if $xoops_isadmin == true}>

<td class="even" align="right">
<a href="edit.php?forum=<{$forum_id}>&post_id=<{$topic_post.post_id}>&topic_id=<{$topic_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>"><img src="<{$xoops_url}>/images/icons/edit.gif" alt="<{$lang_edit}>" /></a><a href='delete.php?forum=<{$forum_id}>&topic_id=<{$topic_id}>&post_id=<{$topic_post.post_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>'><img src="<{$xoops_url}>/images/icons/delete.gif" alt="<{$lang_delete}>" /></a><a href='reply.php?forum=<{$forum_id}>&post_id=<{$topic_post.post_id}>&topic_id=<{$topic_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>'><img src="<{$xoops_url}>/images/icons/reply.gif" alt="<{$lang_reply}>" /></a></right></td>


Replace <{if $xoops_isadmin == true}> with <{if $viewer_is_admin == true}>.

Voila! Moderators can now delete and edit individual posts!



47
Jack404
Re: IP Addresses in Forums
  • 2003/7/5 4:46

  • Jack404

  • Just popping in

  • Posts: 56

  • Since: 2003/5/16


Hehe, just figured it out. XOOPS actually already defines a template variable for it. Just put <{$topic_post.post_poster_ip}> where you'd like the IP address to show up. For example, this is my template for newbb_thread.html:

Quote:

<!-- start comment post -->
<tr>
<td class="head"><a id="forumpost<{$topic_post.post_id}>"></a> <{$topic_post.poster_uname}></td>
<td class="head"><div class="comDate"><span class="comDateCaption"><{$lang_postedon}></span> <{$topic_post.post_date}></div></td>
</tr>
<tr>

<{if $topic_post.poster_uid != 0}>

<td class="odd"><div class="comUserRank"><div class="comUserRankText"><{$topic_post.poster_rank_title}></div><{$topic_post.poster_rank_image}></div><img class="comUserImg" src="<{$xoops_url}>/uploads/<{$topic_post.poster_avatar}>" alt="" /><div class="comUserStat"><span class="comUserStatCaption"><{$lang_joined}>:</span> <{$topic_post.poster_regdate}></div><div class="comUserStat"><span class="comUserStatCaption"><{$lang_from}>:</span> <{$topic_post.poster_from}></div><div class="comUserStat"><span class="comUserStatCaption"><{$lang_posts}>:</span> <{$topic_post.poster_postnum}></div><div class="comUserStatus"><{$topic_post.poster_status}></div></td>

<{else}>

<td class="odd"> </td>

<{/if}>

<td class="odd">
<div class="comTitle"><{$topic_post.post_title}></div><div class="comText"><{$topic_post.post_text}></div>
</td>
</tr>
<tr>
<td class="even"></td>

<{if $xoops_isadmin || $xoops_ismoderator == true}>

<td class="even" align="right">
<img src="<{$xoops_url}>/images/icons/ip.gif" alt="<{$topic_post.post_poster_ip}>" /><a href="edit.php?forum=<{$forum_id}>&post_id=<{$topic_post.post_id}>&topic_id=<{$topic_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>"><img src="<{$xoops_url}>/images/icons/edit.gif" alt="<{$lang_edit}>" /></a><a href='delete.php?forum=<{$forum_id}>&topic_id=<{$topic_id}>&post_id=<{$topic_post.post_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>'><img src="<{$xoops_url}>/images/icons/delete.gif" alt="<{$lang_delete}>" /></a><a href='reply.php?forum=<{$forum_id}>&post_id=<{$topic_post.post_id}>&topic_id=<{$topic_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>'><img src="<{$xoops_url}>/images/icons/reply.gif" alt="<{$lang_reply}>" /></a>
</td>

<{elseif $xoops_isuser == true && $xoops_userid == $topic_post.poster_uid}>

<td class="even" align="right">
<img src="<{$xoops_url}>/images/icons/ip.gif" alt="" /><a href="edit.php?forum=<{$forum_id}>&post_id=<{$topic_post.post_id}>&topic_id=<{$topic_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>"><img src="<{$xoops_url}>/images/icons/edit.gif" alt="<{$lang_edit}>" /></a><a href='reply.php?forum=<{$forum_id}>&post_id=<{$topic_post.post_id}>&topic_id=<{$topic_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>'><img src="<{$xoops_url}>/images/icons/reply.gif" alt="<{$lang_reply}>" /></a>
</td>

<{elseif $viewer_can_post == true}>

<td class="even" align="right">
<img src="<{$xoops_url}>/images/icons/ip.gif" alt="" /><a href='reply.php?forum=<{$forum_id}>&post_id=<{$topic_post.post_id}>&topic_id=<{$topic_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>'><img src="<{$xoops_url}>/images/icons/reply.gif" alt="<{$lang_reply}>" /></a>
</td>

<{else}>

<td class="even"> </td>

<{/if}>

</tr>
<!-- end comment post -->



48
Jack404
Re: IP Addresses in Forums
  • 2003/7/5 2:22

  • Jack404

  • Just popping in

  • Posts: 56

  • Since: 2003/5/16


Ack, I guess I'd better hope a Dev reads this and can point me in the right direction...

I've looked EVERYWHERE for where the template <{$variables}> are defined, but no luck yet. Does anyone have an idea?



49
Jack404
Re: IP Addresses in Forums
  • 2003/7/5 0:34

  • Jack404

  • Just popping in

  • Posts: 56

  • Since: 2003/5/16


I've gotten as far as having the IP.gif show up in the forums, but I'm not sure what to put in alt="" for the img tags. I've tried <{$poster_ip}>, and this doesn't work. Where does XOOPS assign things like <{$topic_post.poster_from}> that are used in the templates? If someone can point that to me, I'd be able to figure out the rest



50
Jack404
Re: IP Addresses in Forums
  • 2003/7/4 23:53

  • Jack404

  • Just popping in

  • Posts: 56

  • Since: 2003/5/16


I also found this, starting on line 221:

Quote:

function getPost($id) {
$sql = 'SELECT p.*, t.post_text, tp.topic_status FROM '.$this->db->prefix('bb_posts').' p LEFT JOIN '.$this->db->prefix('bb_posts_text').' t ON p.post_id=t.post_id LEFT JOIN '.$this->db->prefix('bb_topics').' tp ON tp.topic_id=p.topic_id WHERE p.post_id='.$id;
$array = $this->db->fetchArray($this->db->query($sql));
$this->post_id = $array['post_id'];
$this->pid = $array['pid'];
$this->topic_id = $array['topic_id'];
$this->forum_id = $array['forum_id'];
$this->post_time = $array['post_time'];
$this->uid = $array['uid'];
$this->poster_ip = $array['poster_ip'];
$this->subject = $array['subject'];
$this->nohtml = $array['nohtml'];
$this->nosmiley = $array['nosmiley'];
$this->icon = $array['icon'];
$this->attachsig = $array['attachsig'];
$this->post_text = $array['post_text'];
if ($array['pid'] == 0) {
$this->istopic = true;
}
if ($array['topic_status'] == 1) {
$this->islocked = true;
}
}




TopTop
« 1 2 3 4 (5) 6 »



Login

Who's Online

166 user(s) are online (100 user(s) are browsing Support Forums)


Members: 0


Guests: 166


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits