TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 72
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 59
  • Total: 59

Email Page

Started by Rabain, October 31, 2007, 03:42:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rabain

Hi Guys,

Another question:

I want to create a button that will only appear if a Registered User is logged in and has a domain email.  I guess I can manage this by assigning an "email" membergroup to those members who I have created a site email for.

What do I need to add to the "Add an extra button" doc code to make it based off the membergroup assigned?

if (in_array($context['current_action'], array('links','search', 'admin', 'arcade','calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'forum', 'tpadmin', 'YOUR-ARRAY-TEXT')))
$current_action = $context['current_action'];

//and

// Show the [YOUR-BUTTON-TEXT] button.
echo ($current_action == 'YOUR-ARRAY-TEXT' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'YOUR-ARRAY-TEXT' ? 'active_back' : 'back' , '">
<a href="YOUR-LINK-HERE">YOUR-BUTTON-TEXT</a>
</td>' , $current_action == 'YOUR-ARRAY-TEXT' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Also I want the button to go to a new page where I can set up the access to SquirrelMail (as this is what I use currently to access domain emails). Can I copy something like the gallery page, rename it, remove the gallery stuff and add the relevant SquirrelMail stuff? 

As you can see, I'm at a loss as to how to incorporate the TP/Forum stuff into a completly new site page.

thanks,

Rabain

IchBin

To put a check for membergroup type this:

if (in_array(2, $user_info['groups'])){
button code in here
}


Yes you can copy the code and just change what you need.

jacortina

If you're sure that all the members you want to target will be using the domain email as their forum email, you can check for that instead of making up a new group:

$email_domain = "@your-domain-name.tld";
if (substr($user_info['email'], ((-1)*strlen($email_domain))) == $email_domain) {
...
[processing for domain email members]
...
}


The $user_info array's 'email' entry will hold the user's email address. The negative starting position for the substr() function makes it count positions backwards from the end of the string.

Rabain

#3
They may not be using their domain email as their forum email however what I'm aiming for is that the email button only appears for those who actually have a domain email.

I can do this either by creating a membergroup to track members with domain email or possibly having some kind of file with a list of domain email holders that is checked at login? (The latter I have no idea of how to do! :) ).

With regard to Ichbin's code;  I would add this under the existing "inarray($context..." code above or I place this directly above the button code and thus completely separate it from the above code?

jacortina

Frankly, I think it would be easier for you to track and maintain the membergroup than to be constantly editing a file and uploading it (reading it in is pretty trivial, though I won't obscure the issue now by getting into that).

The form IchBin gave would be used like this:
if (in_array($context['current_action'], array('links','search', 'admin', 'arcade','calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'forum', 'tpadmin', 'YOUR-ARRAY-TEXT')))
$current_action = $context['current_action'];

//and

if (in_array(##, $user_info['groups']) || $user_info['is_admin'] ){
// Show the [YOUR-BUTTON-TEXT] button.
echo ($current_action == 'YOUR-ARRAY-TEXT' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'YOUR-ARRAY-TEXT' ? 'active_back' : 'back' , '">
<a href="YOUR-LINK-HERE">YOUR-BUTTON-TEXT</a>
</td>' , $current_action == 'YOUR-ARRAY-TEXT' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
}


Replace the '##' with the number of the membergroup that gets to see the button (the code above makes sure it shows to Admin(s), too, without having to add them to the group).

Now, most of that code has to do with defining an SMF 'action'. If this button is simply going to link to a page outside the forum, it's not really necessary. I'm not really familiar with accessing Squirrel Mail.

Rabain

Thanks muchly.

I'm not too familiar with how accessing SquirrelMail works either but I'm hoping I can place a login screen directly into a site page.

More research awaits...

This website is proudly hosted on Crocweb Cloud Website Hosting.