Seleccionar idioma:
Realizar Donación - Mods Premium - Portfolio



Este sitio utiliza cookies propias y de terceros. Si continúa navegando consideramos que acepta el uso de cookies. OK Más Información.
* Thankomatic - need help with code permissions to display image based on guest
  Leído 1958 veces
* Viendo el foro
 0 Usuarios y 1 Visitante están viendo este foro.


*
Ago 16 2012


I've modified the thankomatic code so that instead of a Thank You button it displays a smiley icon which you can click to give a 'thank you'. Currently the way it works is that it checks if you can give the post a smiley, if you can then it shows the smiley icon wrapped inside the thank you url. Otherwise it just shows the smiley icon without a link.

What I want to happen is that the smiley icon will not show if the user cannot thank the post and the post hasn't already been thanked. So for example in the image below if I was a guest then the bottom smiley icon shouldn't appear.



Here is the code I'm currently using that displays the smiley link icon:

Código: [Seleccionar]
// Show the Thank You list or the link or.... nothing? XD
echo '<div class="ThankOMatic">';
// Output the Template for Thank-O-Matic (Normal found in the index.template.php)
// It will fall back into a standard function, if this template_thank_you_post doesn't exists!
if ($message['thank_you_post']['isThankYouPost'])
{
// Mistake? Function not loaded oO.
if (empty($context['call_thank_you_post_func']))
loadThankYouTemplateFunctions();

// Call the correct function =D
$context['call_thank_you_post_func']($message['thank_you_post'], $message['id']);
}

// Can do some Thank You Post things :)
if ($message['thank_you_post']['post'] && !$message['thank_you_post']['locked'])
{
echo ' <a id="buttonThxHrefID' . $message['id'] . '" href="', $scripturl, '?action=thankyou;topic=', $context['current_topic'], '.0;msg=', $message['id'], '"'.(!empty($modSettings['thankYouPostAJAX']) ? ' onclick="return thankyou(' . $message['id'] . ');"' : '').'><img src="' . $settings['images_url'] . '/smiley.gif" align="top" style="padding-top:2px;"></a>';
}
else
{
echo' <img src="' . $settings['images_url'] . '/smiley.gif" align="top" style="padding-top:2px;">';
}

echo '
</div>';

Is this possible at all? Thanks. Great mod by the way. :)

none
2.0.2
none

Mensajes: 6

Ver Perfil 

En línea

*
Ago 16 2012


And you want it then appears?

A legend an error message...

Regards enik...

SmfPersonal Ex-Project maneger
#1

Mensajes: 3358

Ver Perfil  Email 

En línea

*
Ago 16 2012


I'm sorry I don't understand.

I want the icon not to appear on the following condition: If nobody has thanked the post and the user cannot thank the post (either because he made the post or he is a guest).

none
2.0.2
none
#2

Mensajes: 6

Ver Perfil 

En línea

*
Ago 16 2012


Mmm please test this:

Código: [Seleccionar]
// Show the Thank You list or the link or.... nothing? XD
        echo '<div class="ThankOMatic">';
        // Output the Template for Thank-O-Matic (Normal found in the index.template.php)
        // It will fall back into a standard function, if this template_thank_you_post doesn't exists!
        if ($message['thank_you_post']['isThankYouPost'])
        {
            // Mistake? Function not loaded oO.
            if (empty($context['call_thank_you_post_func']))
                loadThankYouTemplateFunctions();

            // Call the correct function =D
            $context['call_thank_you_post_func']($message['thank_you_post'], $message['id']);
        }
       
        // Can do some Thank You Post things :)
        if ($message['thank_you_post']['post'] && !$message['thank_you_post']['locked'])
        {
            echo ' <a id="buttonThxHrefID' . $message['id'] . '" href="', $scripturl, '?action=thankyou;topic=', $context['current_topic'], '.0;msg=', $message['id'], '"'.(!empty($modSettings['thankYouPostAJAX']) ? ' onclick="return thankyou(' . $message['id'] . ');"' : '').'><img src="' . $settings['images_url'] . '/smiley.gif" align="top" style="padding-top:2px;"></a>';
        }
        elseif ($context['user']['is_guest'])
        {
    echo 'Sorry you Do not view thank you list !!!';
    }
        else
        {
        echo'This topic has not yet thanks';
        }
       
        echo '
                            </div>';

Regards enik...

SmfPersonal Ex-Project maneger
#3

Mensajes: 3358

Ver Perfil  Email 

En línea

*
Ago 16 2012


Hmm... that didn't really work because it completely disappears if you're a guest which I don't want. In terms of pseudo-code I'm looking for something more like this:

Código: [Seleccionar]
if user_can_thank_post
{
  [url][icon][/url]
}
else if post_has_been_thanked
{
  [icon]
}

none
2.0.2
none
#4

Mensajes: 6

Ver Perfil 

En línea

*
Ago 16 2012


the code that I provide, if are guests told they can not see thanks

 and if no thanks, displays a message saying that the message has no thanks.

I do not understand what else you want to put  :o

Regards enik...

SmfPersonal Ex-Project maneger
#5

Mensajes: 3358

Ver Perfil  Email 

En línea

*
Ago 17 2012


The problem is that it's not as simple as that. I'd like the following.

If (the user is a guest or he made the post) and (somebody else has thanked the post)
echo "2 gave this a [smiley_icon]"

If (the user is a guest or he made the post) and (nobody has thanked the post)
echo "empty"

if (user is logged in and can thank post) and (somebody else has thanked the post)
echo "2 gave this a [url_thank_you][smiley_icon][/url]"

if (user is logged in and can thank post) and (nobody has thanked the post)
echo "[url_thank_you][smiley_icon][/url]"

none
2.0.2
none
#6

Mensajes: 6

Ver Perfil 

En línea

*
Ago 28 2012


Have you tried using CSS to apply a background image to the class that applies to the 'thank-you' link?
For example, Index.css contains the following after installing thank-o-matic
Código: [Seleccionar]
/* This are the the Thank-O-Matic Buttons START */
ul.quickbuttons li.thank_you_button
{
   background: url(../images/buttons/thank_you_button.png) no-repeat;
}
Without this code, or if the link is broken, you will only see the link - no button.

1.1.11, 2.0.2
#7

Mensajes: 1

Ver Perfil 

En línea




Otros temas de su interes

ADK Blog - BR tags when editing? NekoJonez Mayo 28, 2013, 08:10:11 am
Thank-O-Matic: How to style ??? Draffi Octubre 10, 2013, 06:46:03 pm *
Problem with hide tag special 3.0 r4ll Agosto 12, 2014, 07:47:46 am *
Hide tag - add some css? Nightmaster Mayo 05, 2012, 06:54:33 pm *
Thank-O-Matic double image buttons FamilyWeb Mayo 08, 2014, 01:31:11 am *
Adk Gallery sql database error? Lyfing Febrero 29, 2012, 07:32:50 pm *



Usuario:
Contraseña:
Sesión:
hermes bracelet replica, christian louboutin replica, van cleef and arpels replica, red bottoms replica, cartier love bracelet replica christian louboutin replica, christian louboutin replica, hermes bracelet replica,