Topic-icon Social toolbar

Active Subscriptions:

None
9 years 9 months ago #59444 by christos_spil
Social toolbar was created by christos_spil
Hello there,
I have published the social tollbar and enabled alpha user points rules for fb like and Twitter post to assign 20 points to user for each action. I have created a div that renders the total points of the user but I would like it to update without refreshing the page each time an user action is done. Can u pls provide me with information on which file the insert of the points are for the above action ? Do you think this is smt that can be done. I would like to customize the call of the ajax done when these actions are completed an on success update the points div

Thanks in advance
The topic has been locked.
Support Specialist
9 years 8 months ago #59463 by alzander
Replied by alzander on topic Social toolbar
You would need to modify our /components/com_jfbconnect/includes/jfbconnect.js file to do what you're looking for. In there, using Twitter as an example, around line 260, you can see:
twitter: {
            tweet: function (intentEvent)
            {
                if (!intentEvent) return;
//            var id = intentEvent.tweet_id;
//            var username = intentEvent.screen_name;
                var href = document.location.href;
                var url = 'option=com_jfbconnect&task=social.share&provider=twitter&share=tweet&type=create&href=' + encodeURIComponent(escape(href)) + '&title=' + document.title;
                jfbc.util.ajax(url, null);
            }
That function, ending with the jfbc.util.ajax(url,null) call is what is triggered when a user uses the Tweet button. You can add whatever code you want there to update your div on the page. There are similar functions for Facebook and LinkedIn in that section as well.

I hope that helps, but if you need anything else, just let us know.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
9 years 8 months ago #59496 by christos_spil
Replied by christos_spil on topic Social toolbar
hello Alex,

i can't understand in which file the post is done so i can customize the (probably) php file and return the information i need.

Can u pls help?
The topic has been locked.
Support Specialist
9 years 8 months ago #59504 by alzander
Replied by alzander on topic Social toolbar
If you want to dynamically update the page using Javascript, you'll need to hook into the file I noted above somewhere. The PHP code we execute when a user shares content doesn't alter the look of the page normally. You'd need to add whatever updates to the HTML you want and call that Javascript update in the jfbconnect.js file I mentioned above.

I hope that helps explain a little more. In general though, AJAX is based off of Javascript, so that's where you'd need to at least start the request to the server to get whatever data you want to show on the page.

Thanks,
Alex
The topic has been locked.
Support Specialist
9 years 8 months ago #59505 by alzander
Replied by alzander on topic Social toolbar
Just to make sure we understand what you want to do:
You have a widget on the page that shows how many Alpha User Points the current user has. When a user clicks the Facebook Like button, you want the widget to automatically update, without reloading the page, to show the new point total including the points they just got for clicking the Like button.

Is that correct? If so, my answer above is still right. You'd need to use the Javascript call in our jfbconnect.js file to call some other code of yours which will update that widget. That may make an AJAX call to the server or could be something as simple as just incrementing the points displayed for the user automatically.
The topic has been locked.
Active Subscriptions:

None
9 years 8 months ago #59683 by christos_spil
Replied by christos_spil on topic Social toolbar
Hello,

ok thanks for the advices. Still one question. When a twitter post is done the widget probably calls the aup function to give points (function newpoints). In which file is this call beeing done?

Thanks
The topic has been locked.
Support Specialist
9 years 8 months ago #59691 by mel
Replied by mel on topic Social toolbar
There is a 'Social Profiles - Alpha User Points' plugin. With a quick glance, the code seems to be in /plugins/socialprofiles/alphauserpoints/alphauserpoints.php. There is a method in the end of that file called awardPoints. Any rules for JFBConnect are in the alphauserpoints_rule.xml.

I hope this helps, but let us know if you have any more questions.

-Melissa
The topic has been locked.