Posted By

krunkosaurus on 05/06/09


Tagged

kickapps groups


Versions (?)

KickApps: Add join group to groups list page


 / Published in: JavaScript
 

For a way to add quick "join group" functionality to your group list page - put this code in your AC footer (wrapped in script tags).

-- For more tips and tricks checkout the KickApps resources page.

  1. if (Ka.Info.PAGE === "search/searchPage.jsp" && Ka.Util.getLocationParam('mediaType') === 'group') {
  2.  
  3. $j(function() {
  4.  
  5. var userid = Ka.Info.USERID;
  6. var aff = Ka.Info.AFFILIATESITEID;
  7.  
  8. $j('#ka_contentContainer li.ka_list').each(function() {
  9. var $li = $j(this);
  10. var group = $li.find('h4 a:first').attr('href').match(/\/(\d.*)\//)[1];
  11. var $button = $j('<button>Join Group</button>').click(function() {
  12. KickAppsBizComponent.joinClub(group, userid, aff,
  13. function(joined) {
  14. if (joined) {
  15. $button.text('joined').attr('disabled', 'disabled');
  16. }
  17. });
  18. });
  19. KickAppsBizComponent.isUserMemberOfClub(userid, group, aff,
  20. function(isMember) {
  21. if (!isMember) {
  22.  
  23. $li.append($button);
  24. }
  25. });
  26. });
  27.  
  28. });
  29.  
  30. }

Report this snippet  

You need to login to post a comment.