The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Placing Points in a widget

4 posters

Go down

Solved Placing Points in a widget

Post by Scarlet D. April 8th 2016, 11:30 pm

Technical Details


Forum version : #PunBB
Position : Founder
Concerned browser(s) : Mozilla Firefox, Google Chrome, Opera
Who the problem concerns : All members
Forum link : http://onepiecegr.forumgreek.com/forum

Description of problem

Quick question: I am trying to add the points field in the login widget using templates but i can't find any solution, is it possible to do something like this at all?


Last edited by Heartsealed on April 10th 2016, 4:55 pm; edited 1 time in total
Scarlet D.
Scarlet D.
Forumember

Male Posts : 130
Reputation : 2
Language : Greek,English
Location : Athens,Greece

http://onepiecegr.forum-pro.org/

Back to top Go down

Solved Re: Placing Points in a widget

Post by SLGray April 8th 2016, 11:37 pm

This will all profile fields to a widget:
Code:
<!-- BEGIN profile_field -->
{postrow.displayed.profile_field.LABEL} {postrow.displayed.profile_field.CONTENT}{postrow.displayed.profile_field.SEPARATOR}
<!-- END profile_field -->


Placing Points in a widget Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Placing Points in a widget

Post by Scarlet D. April 8th 2016, 11:51 pm

hmmm for some reason when i put it there nothing happens, can you check my code?

Code:
  <div class="module main">
      <!-- BEGIN switch_login -->
      <div class="main-head"><h1 class="page-title">{L_LOGIN}</h1></div>
      <div class="main-content">
      <form action="{S_LOGIN_ACTION}" method="post">
      <fieldset class="frm-set login">
          <dl>
            <dt><label for="username">{L_USERNAME}:</label></dt>
            <dd><input type="text" tabindex="1" name="username" id="username" size="20" maxlength="40" value="{USERNAME}" class="inputbox autowidth" /></dd>
          </dl>
          <dl>
            <dt><label for="password">{L_PASSWORD}:</label></dt>
            <dd><input type="password" tabindex="2" id="password" name="password" size="20" maxlength="25" class="inputbox autowidth" /></dd>
            <dd><a href="{U_SEND_PASSWORD}" rel="nofollow">{L_SEND_PASSWORD}</a></dd>
          </dl>
          <dl>
            <dd><label for="autologin"><input type="checkbox" name="autologin" id="autologin" tabindex="4" class="checkbox" {AUTOLOGIN_CHECKED} /> {L_AUTO_LOGIN}</label></dd>
          </dl>
          <dl>
            <dd style="text-align:center;"><input type="submit" name="login" tabindex="6" value="{L_LOGIN}" class="button1" /></dd>
          </dl>
                    <!-- BEGIN switch_fb_connect_login -->
                    <dl>
            <dd style="text-align:center;"> 
                                <div class="fb_login_widget">
                                    <div class="fb_or_widget">{switch_login.switch_fb_connect_login.L_OR}</div>
                                    <fb:login-button size="large" onlogin="window.location='/facebook_connect.forum'" scope="{switch_login.switch_fb_connect_login.L_FB_PERMISSIONS}" class="margTop4">{switch_login.switch_fb_connect_login.L_FB_LOGIN_BUTTON}</fb:login-button>
                                </div>
                            </dd>
          </dl>
                    <!-- END switch_fb_connect_login -->
      </fieldset>
      </form>
      </div>
      <!-- END switch_login -->

      <!-- BEGIN switch_login_small -->
      <div class="main-head"><h1 class="page-title">{L_LOGIN}</h1></div>
      <div class="main-content">
      <form action="{S_LOGIN_ACTION}" method="post">

      <p><label for="username"><strong>{L_USERNAME}:</strong></label></p>
      <p style="height:2em;valign:top;"><input type="text" name="username" id="username" size="15" maxlength="40" value="{USERNAME}" class="inputbox autowidth" /></p>
      <p><label for="password"><strong>{L_PASSWORD}:</strong></label></p>
      <p style="height:2em;valign:top;"><input type="password" id="password" name="password" size="15" maxlength="25" class="inputbox autowidth" /></p>
      <p><a href="{U_SEND_PASSWORD}" rel="nofollow">{L_SEND_PASSWORD}</a></p>
            <br>
      <p><input type="checkbox" name="autologin" id="autologin" tabindex="4" class="checkbox" {AUTOLOGIN_CHECKED} /><label for="autologin"> {L_AUTO_LOGIN}</label></p>
            <br>
            <p align="center"><input type="submit" name="login" tabindex="6" value="{L_LOGIN}" class="button1" /></p>
            <!-- BEGIN switch_fb_connect_login -->
                                <div class="fb_login_widget">
                                    <div class="fb_or_widget">{switch_login_small.switch_fb_connect_login.L_OR}</div>
                                    <p align="center"><fb:login-button size="small" onlogin="window.location='/facebook_connect.forum'" scope="{switch_login_small.switch_fb_connect_login.L_FB_PERMISSIONS}" class="margTop4">{switch_login_small.switch_fb_connect_login.L_FB_LOGIN_BUTTON}</fb:login-button>
                                </p>
                                </div>
                    <!-- END switch_fb_connect_login -->
      </form>
      </div>
      <!-- END switch_login_small -->

         
      <!-- BEGIN switch_profile -->
      <div class="main-content clearfix details">
      <div class="left">
        <dd style="text-align: center;"><h1>WANTED</h1></dd>
        <br>
          <dd style="text-align: center;">{USERNAME_AVATAR}</dd>
        <dd style="text-align: center;"><h4>DEAD OR ALIVE</h4></dd>
      </div>
      <dl class="left">
        <div style="text-align: right;"><h3>{USERNAME}</h3></div>
          <dt>{L_MESSAGES}: <strong>{NB_MESSAGES}</strong> </dt>
                <!-- BEGIN profile_field -->
        <dt>{postrow.displayed.profile_field.LABEL} :{postrow.displayed.profile_field.CONTENT}{postrow.displayed.profile_field.SEPARATOR}</dt>
        <!-- END profile_field -->
            
                       
        <dd style="text-align: center;"><a href="{U_PROFILE}">{L_MY_PROFILE}</a></dd>
      </dl>
      </div>
      <!-- END switch_profile -->
    </div>
    <!-- BEGIN switch_fb_widget_login -->
    <div id="fb-root"></div>
    <script>
        FB.init({
          appId      : {switch_fb_widget_login.FACEBOOK_APP_ID},
          cookie    : true,
          xfbml      : true,
          oauth      : true,
          version    : 'v2.3'
        });

      (function(d, s, id){
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {return;}
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/sdk.js";
        fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));
    </script>
    <!-- END switch_fb_widget_login -->
<style>
.module .main-content {
    padding: 1em;
    background: url('http://i65.tinypic.com/2n9m1lf.jpg') no-repeat;
}
</style>
Scarlet D.
Scarlet D.
Forumember

Male Posts : 130
Reputation : 2
Language : Greek,English
Location : Athens,Greece

http://onepiecegr.forum-pro.org/

Back to top Go down

Solved Re: Placing Points in a widget

Post by SLGray April 9th 2016, 4:12 am

Are you adding that to a widget?


Placing Points in a widget Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Placing Points in a widget

Post by SSYT April 9th 2016, 11:14 am

Code:
<div id="get_point"></div>

Code:
$(function() {
$('#get_point').html(_userdata.user_posts);
});

or

Code:
$(function() {
$('#get_point').load('/u'+ _userdata.user_id +' div#profile-advanced-details', function(d) {
$(this).html($('dl#field_id-13 .field_uneditable', d).text());
});
});
SSYT
SSYT
Forumember

Male Posts : 77
Reputation : 15
Language : RO-10, EN-3, FR-1
Location : Romania

http://help.forumgratuit.ro/forum

Back to top Go down

Solved Re: Placing Points in a widget

Post by Scarlet D. April 9th 2016, 12:21 pm

SLGray wrote:Are you adding that to a widget?

I am modifing the forummotion's Login widget (Mod_login template)

Phyton wrote:
Code:
<div id="get_point"></div>

Code:
$(function() {
$('#get_point').html(_userdata.user_posts);
});

or

Code:
$(function() {
$('#get_point').load('/u'+ _userdata.user_id +' div#profile-advanced-details', function(d) {
$(this).html($('dl#field_id-13 .field_uneditable', d).text());
});
});

for some reason none of these is working ++ i can't make any element of the widget get aligned to the center of the widget (username, posts etc.)
Scarlet D.
Scarlet D.
Forumember

Male Posts : 130
Reputation : 2
Language : Greek,English
Location : Athens,Greece

http://onepiecegr.forum-pro.org/

Back to top Go down

Solved Re: Placing Points in a widget

Post by SLGray April 9th 2016, 8:32 pm

Are you publishing the modified template?


Placing Points in a widget Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Solved Re: Placing Points in a widget

Post by Scarlet D. April 9th 2016, 9:14 pm

SLGray wrote:Are you publishing the modified template?
lol of course dude i am not stupid Very Happy


btw i fixed the align problem but not i still can't make my points view on the widget
Scarlet D.
Scarlet D.
Forumember

Male Posts : 130
Reputation : 2
Language : Greek,English
Location : Athens,Greece

http://onepiecegr.forum-pro.org/

Back to top Go down

Solved Re: Placing Points in a widget

Post by Ange Tuteur April 10th 2016, 4:51 pm

You'll need to use AJAX to get the point value. Add this to your template :
Code:
Points : <span id="points_value"></span>
<script type="text/javascript">//<![CDATA[
jQuery.get('/u' + _userdata.user_id, function(d) {
  var points = $('#field_id-13 .field_uneditable', d)[0];
  if (points) document.getElementById('points_value').innerHTML = points.innerHTML;
});
//]]></script>
Just place it where you want the points to display.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Placing Points in a widget

Post by Scarlet D. April 10th 2016, 4:55 pm

Ange Tuteur wrote:You'll need to use AJAX to get the point value. Add this to your template :
Code:
Points : <span id="points_value"></span>
<script type="text/javascript">//<![CDATA[
jQuery.get('/u' + _userdata.user_id, function(d) {
  var points = $('#field_id-13 .field_uneditable', d)[0];
  if (points) document.getElementById('points_value').innerHTML = points.innerHTML;
});
//]]></script>
Just place it where you want the points to display.

huh, forgot to say but phyton's second script actually worked, the align ,however, prevented me from seeing it in first place, when i fixed the mod_login's template align, it appeared!
Scarlet D.
Scarlet D.
Forumember

Male Posts : 130
Reputation : 2
Language : Greek,English
Location : Athens,Greece

http://onepiecegr.forum-pro.org/

Back to top Go down

Solved Re: Placing Points in a widget

Post by SLGray April 11th 2016, 12:09 am

Topic solved and archived


Placing Points in a widget Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum