Help needed with a complicated mod!
Posted by Mandingo
Help needed with a complicated mod! July 10, 2004 03:42PM |
Registered: 23 years ago Posts: 109 |
O.K. So I'm brave enough to try to do this mod with the 'Subscribe to this thread' option. I want it so a user can subscribe to a thread regardless of whether they've posted on that thread or not. I've set it up so an option appears on the first message of every thread. Like this
I've added this in 'Read.tpl' -
{IF MESSAGES->parent_id 0}<a class="PhorumNavLink" href="{MESSAGES->email_reply}">{LANG->EmailReplies}</a>{/IF}</td>
& this in 'read.php' at the bottomn of the section that starts with "// this stuff is used in threaded and non threaded." -
$row["email_reply"] = phorum_get_url(PHORUM_READ_URL, $row["thread"], $row["message_id"], "subthreads=1");
It works in the read.tpl template, and when you click on a link it seems to go somewhere, but it doesn't show up in the 'subscribed threads' in the Control Center. Obviously I'm missing something somewhere. Any ideas where I'm going wrong?
I know this mod isn't to everyones taste, and is maybe 'unnecessary' but it might be useful to some, besides, I've started doing it now and I'm determined! ;-) Any help would be greatly appreciated.
BTW, it's not 'bookmarking' I'm doing, despite what it says in the graphic (I was just playing around with the lang script) it's just a case of changing the way you subscribe to a thread.
Edited 1 time(s). Last edit at 07/10/2004 03:51PM by Mandingo.
I've added this in 'Read.tpl' -
{IF MESSAGES->parent_id 0}<a class="PhorumNavLink" href="{MESSAGES->email_reply}">{LANG->EmailReplies}</a>{/IF}</td>
& this in 'read.php' at the bottomn of the section that starts with "// this stuff is used in threaded and non threaded." -
$row["email_reply"] = phorum_get_url(PHORUM_READ_URL, $row["thread"], $row["message_id"], "subthreads=1");
It works in the read.tpl template, and when you click on a link it seems to go somewhere, but it doesn't show up in the 'subscribed threads' in the Control Center. Obviously I'm missing something somewhere. Any ideas where I'm going wrong?
I know this mod isn't to everyones taste, and is maybe 'unnecessary' but it might be useful to some, besides, I've started doing it now and I'm determined! ;-) Any help would be greatly appreciated.
BTW, it's not 'bookmarking' I'm doing, despite what it says in the graphic (I was just playing around with the lang script) it's just a case of changing the way you subscribe to a thread.
Edited 1 time(s). Last edit at 07/10/2004 03:51PM by Mandingo.
Re: Help needed with a complicated mod! July 11, 2004 05:22AM |
Registered: 20 years ago Posts: 47 |
It's really not that complicated. You just need to call the function
> I've added this in 'Read.tpl' -
>
> {IF MESSAGES->parent_id 0}<a class="PhorumNavLink" href="{MESSAGES->email_reply}">{LANG->EmailReplies}</a>{/IF}</td>
good... you should also check that the user is logged in. ie {IF LOGGEDIN}...
> & this in 'read.php' at the bottomn of the
> section that starts with "// this stuff is used in
> threaded and non threaded." -
>
> $row["email_reply"] = phorum_get_url(PHORUM_READ_URL, $row["thread"], $row["message_id"], "subthreads=1");
good. So the URL is set up properly. Now what is read.php going to do when it's called with the subthreads=1 argument?
Near the top of read.php, you should put something like this:
PS: hi Mike...
phorum_user_subscribe( $user_id, $forum_id, $thread, $type )when the link is clicked.
> I've added this in 'Read.tpl' -
>
> {IF MESSAGES->parent_id 0}<a class="PhorumNavLink" href="{MESSAGES->email_reply}">{LANG->EmailReplies}</a>{/IF}</td>
good... you should also check that the user is logged in. ie {IF LOGGEDIN}...
> & this in 'read.php' at the bottomn of the
> section that starts with "// this stuff is used in
> threaded and non threaded." -
>
> $row["email_reply"] = phorum_get_url(PHORUM_READ_URL, $row["thread"], $row["message_id"], "subthreads=1");
good. So the URL is set up properly. Now what is read.php going to do when it's called with the subthreads=1 argument?
Near the top of read.php, you should put something like this:
// check for subscription request if(!empty($PHORUM["args"]["subthreads"]) && $PHORUM["DATA"]["LOGGEDIN"]) { phorum_user_subscribe($PHORUM["user"]["user_id"], $PHORUM['forum_id'], $thread, PHORUM_SUBSCRIPTION_MESSAGE); }Hope that helps.
PS: hi Mike...
Re: Help needed with a complicated mod! July 11, 2004 05:30AM |
Registered: 23 years ago Posts: 109 |
Re: Help needed with a complicated mod! July 11, 2004 06:00AM |
Admin Registered: 22 years ago Posts: 9,240 |
Re: Help needed with a complicated mod! July 11, 2004 06:31AM |
Registered: 23 years ago Posts: 109 |
o.k. I suppose that's worth doing.
How would you prevent this option sending actual emails out? Say if it were just an option to bookmark? At the moment, if I have it set up this way, its' both bookmarking and sending out emails, I'd like users to be able to choose between the two options.
If we can get it together like this, I'll have a go at setting it up as a seperate mod.
How would you prevent this option sending actual emails out? Say if it were just an option to bookmark? At the moment, if I have it set up this way, its' both bookmarking and sending out emails, I'd like users to be able to choose between the two options.
If we can get it together like this, I'll have a go at setting it up as a seperate mod.
Re: Help needed with a complicated mod! July 11, 2004 07:04AM |
Admin Registered: 22 years ago Posts: 9,240 |
Re: Help needed with a complicated mod! July 11, 2004 10:37AM |
Registered: 23 years ago Posts: 109 |
Re: Help needed with a complicated mod! July 11, 2004 10:43AM |
Admin Registered: 22 years ago Posts: 9,240 |
Re: Help needed with a complicated mod! July 11, 2004 11:03AM |
Registered: 23 years ago Posts: 109 |
Re: Help needed with a complicated mod! July 11, 2004 11:50AM |
Registered: 23 years ago Posts: 109 |
Right, so I've created a custom field via the admin control called 'user_save'. The additional lines I now have are:
In 'read.php' =
$row["user_save"] = phorum_get_url(PHORUM_READ_URL, $row["thread"], $row["message_id"], "save=1");
and
// check for subscription request
if(!empty($PHORUM["args"]["save"]) && $PHORUM["DATA"]["LOGGEDIN"]) {
phorum_user_subscribe($PHORUM["user"]["user_id"], $PHORUM['forum_id'], $thread, PHORUM_SUBSCRIPTION_MESSAGE);
and in 'read.tpl'=
{if LOGGEDIN true}{IF MESSAGES->parent_id 0}<a class="PhorumNavLink" href="{MESSAGES->user_save}">{LANG->ThreadSave}</a>{/if}{/IF}</td>
But I guess that doesn't change anything, since I still have 'phorum_user_subscribe' in there?
Edited 2 time(s). Last edit at 07/11/2004 11:51AM by Mandingo.
In 'read.php' =
$row["user_save"] = phorum_get_url(PHORUM_READ_URL, $row["thread"], $row["message_id"], "save=1");
and
// check for subscription request
if(!empty($PHORUM["args"]["save"]) && $PHORUM["DATA"]["LOGGEDIN"]) {
phorum_user_subscribe($PHORUM["user"]["user_id"], $PHORUM['forum_id'], $thread, PHORUM_SUBSCRIPTION_MESSAGE);
and in 'read.tpl'=
{if LOGGEDIN true}{IF MESSAGES->parent_id 0}<a class="PhorumNavLink" href="{MESSAGES->user_save}">{LANG->ThreadSave}</a>{/if}{/IF}</td>
But I guess that doesn't change anything, since I still have 'phorum_user_subscribe' in there?
Edited 2 time(s). Last edit at 07/11/2004 11:51AM by Mandingo.
Sorry, only registered users may post in this forum.