Help emulate Send this Topic

Started by skb, August 21, 2016, 11:46:55 PM

Previous topic - Next topic

skb

I'm trying to emulate " action=emailuser;sa=sendtopic " for the Index page. Would probably add this as an Invite button to the Menu or a side block.
What do I need to do ?

SMF 2.1.4 / TP 2.2.2

skb

The index page is recognized as topic=0, but this code in the SendTopic.php won't recognize "0" as a valid input.// We need at least a topic... go away if you don't have one.
if (empty($topic))
fatal_lang_error('not_a_topic', false);

OR this if ($smcFunc['db_num_rows']($request) == 0)
fatal_lang_error('not_a_topic', false);
$row = $smcFunc['db_fetch_assoc']($request);
$smcFunc['db_free_result']($request);


Please advise ?

SMF 2.1.4 / TP 2.2.2

Suki

#2
$topic will only exists when you are viewing a topic, it won't be defined on yor index page or any other index, boardindex, messageindex, etc.

What are you trying to do, a contact form? depending on what you want to do it might be easier to build something new or use other scripts as base. Sendtopic is too integrated too topics.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

skb

I'm trying to create a 'Tell a Friend' block. With the php files I get permission errors. I've tried changing the settings to 750, 755, 777 but still won't work. With html/js I can send the emails only if the email ID is from our forum. External email like gmail etc will not go.

SMF 2.1.4 / TP 2.2.2

Suki

Posting your script will be a great start.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

skb

Sure. Here is a sample of a javascript & a php file I tried to use. I also tried to create 2 Custom Actions "tellafriend" & a "thankyou", but no luck. BTW phpmail does not work on my forum, so we use smtp. Tried everything with help from you guys the phpmail just does not work. Host says there is no problem at their end.

SMF 2.1.4 / TP 2.2.2

Suki

It seems your script is quite old, $HTTP_POST_VARS were deprecated a few PHP versions ago. Perhaps thats the issue you have, some weirdly configured servers fires 500 errors whenever theres a code error.

Do you want to add this tell a friend bit on your main index page? if so, have you tried to use a "share this" widget?
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

skb

Quote from: Suki on August 23, 2016, 10:15:29 AM
Do you want to add this tell a friend bit on your main index page? if so, have you tried to use a "share this" widget?

Yes, I would like the user to email the index URL to a friend at the click of a button, just like Send this Topic using the admin/webmaster email ID, but with their name & email ID included. I have the Google+ & FaceBook buttons, which appear on all posts. I think (I may be wrong) topic=0 is the index. If so, it shouldn't be difficult to include in the SendTopic.php

For the time being I've created a sticky topic "About the Forum" and use a "Invite Friend" button in a side block with a link to this topic. Works fine, but I would prefer the friend arrives on the index page. 

SMF 2.1.4 / TP 2.2.2

Suki

Well, it would be much better of you use a "share this" plugin/widget.  These days mail isn't the preferred way to promote your site.  Chances are, people will look at the email and tagged it as spam which will have consequences for you if you later decide to use SMF's newsletter system for example.

If you already have a google and facebook for all post, you can sue that for your index page, I believe theres a few mods that adds those buttons to the index page too.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Advertisement: