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.
The forum of the forums
4 posters

    "add friend" js code help

    J0k3R^
    J0k3R^
    Forumember


    Male Posts : 742
    Reputation : 28
    Language : Greek > English > Russian > Spanish
    Location : C:\>r00t

    Solved "add friend" js code help

    Post by J0k3R^ May 11th 2014, 3:48 pm

    Hi,
    i added the codes from this tutorial to my forum
    http://www.avacweb.com/t17p15-re-1-add-as-friend-and-user-wall-link-in-post-profiles
    and it used to work but now my viewtopic_body is heavily edited and it doesnt appear. im using punbb. what should i do? 

    i tried this code:

    Code:
    $(function(){
      ('Copyright ©️ AvacWeb. All Rights Reserved. Use and  modification of this script is not allowed without this entire copyright notice in the original, copied, or modified script. No distribution without consent.');
      var posts = $('.username', document.getElementById('main-content'));
      for(var i = 0, p; (p = posts[i++]); ) {
          var userlink = p.getElementsByTagName('a')[0], name = userlink.innerHTML.replace(/<[^>]+>/g, ''), uid = userlink.href.match(/[0-9]+$/)[0];
          $('.friendlink', p.parentNode.parentNode).html('<a href="/profile?friend=' + name + '&mode=editprofile&page_profil=friendsfoes">Add as Friend</a>');
          $('.walllink', p.parentNode.parentNode).html('<a href="/u' + uid + 'wall">' + name + '\'s Wall</a>');
      }
    });

    and this:

    Code:

    $(function(){
      var posts = $('.username', document.getElementById('main-content')), i = 0, p;
      for(; (p = posts[i++]); ) {
          var userlink = p.getElementsByTagName('a')[0]
          , name = userlink.innerHTML.replace(/<.*?>/g, '')
          , uid = userlink.href.match(/\d+$/)[0];
          p.parentNode.parentNode.innerHTML += '<a href="/profile?friend=' + name + '&mode=editprofile&page_profil=friendsfoes">Add as Friend</a><br><a href="/u' + uid + 'wall">' + name + '\'s Wall</a>';
      }
    });

    but nothing worked. i hope u help me Very Happy
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19328
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: "add friend" js code help

    Post by Ape May 11th 2014, 4:00 pm

    This code no longer works right now LG is going to have a look at it when he gets the time.

    The problem is down to the new editor system and the way codes are made and used.

    Also FM made some little javascript Fixes not so long a go and this knocked some of the javascript's out from LG's systems.  This is a problem to lots of codes no longer working but one by one He is fixing them.

    Ape



    "add friend" js code help Left1212"add friend" js code help Center11"add friend" js code help Right112
    "add friend" js code help Ape_b110
    "add friend" js code help Ape1010
    J0k3R^
    J0k3R^
    Forumember


    Male Posts : 742
    Reputation : 28
    Language : Greek > English > Russian > Spanish
    Location : C:\>r00t

    Solved Re: "add friend" js code help

    Post by J0k3R^ May 11th 2014, 4:27 pm

    this code used to work on my forum just some days ago (maybe a week) but i modify my viewtopic_body very often and i make new changes there so i think thats my problem..
    LGforum
    LGforum
    Hyperactive


    Male Posts : 2265
    Reputation : 264
    Language : English
    Location : UK

    Solved Re: "add friend" js code help

    Post by LGforum May 11th 2014, 8:53 pm

    The code should still work on normal forums - however if you edit your templates, your responsible for editing Javascripts to meet your personalized site. This was mentioned in the tutorial that it likely won't work on PunBB boards with edited templates.

    Someone with knowledge of Javascript may be willing to edit the script for you, but honestly you could probably find a decent way of adding the links in via templates.

    J0k3R^
    J0k3R^
    Forumember


    Male Posts : 742
    Reputation : 28
    Language : Greek > English > Russian > Spanish
    Location : C:\>r00t

    Solved Re: "add friend" js code help

    Post by J0k3R^ May 11th 2014, 9:23 pm

    Lol, im so dumb and i didnt even think about puting this at tempates.. Very Happy Very Happy 
    its good, but what to write instead of  ' + name ' because it needs to be changed to make it work..

    in here:
    Code:
    <a style="position:relative;top:1px;" href="/profile?friend=' + name + '&mode=editprofile&page_profil=friendsfoes">
    J0k3R^
    J0k3R^
    Forumember


    Male Posts : 742
    Reputation : 28
    Language : Greek > English > Russian > Spanish
    Location : C:\>r00t

    Solved Re: "add friend" js code help

    Post by J0k3R^ May 13th 2014, 4:55 pm

    Bump?
    J0k3R^
    J0k3R^
    Forumember


    Male Posts : 742
    Reputation : 28
    Language : Greek > English > Russian > Spanish
    Location : C:\>r00t

    Solved Re: "add friend" js code help

    Post by J0k3R^ May 14th 2014, 6:55 pm

    Bump
    J0k3R^
    J0k3R^
    Forumember


    Male Posts : 742
    Reputation : 28
    Language : Greek > English > Russian > Spanish
    Location : C:\>r00t

    Solved Re: "add friend" js code help

    Post by J0k3R^ May 16th 2014, 6:44 pm

    Bump
    J0k3R^
    J0k3R^
    Forumember


    Male Posts : 742
    Reputation : 28
    Language : Greek > English > Russian > Spanish
    Location : C:\>r00t

    Solved Re: "add friend" js code help

    Post by J0k3R^ May 17th 2014, 6:42 pm

    Bump
    J0k3R^
    J0k3R^
    Forumember


    Male Posts : 742
    Reputation : 28
    Language : Greek > English > Russian > Spanish
    Location : C:\>r00t

    Solved Re: "add friend" js code help

    Post by J0k3R^ May 19th 2014, 6:17 pm

    Bump
    LGforum
    LGforum
    Hyperactive


    Male Posts : 2265
    Reputation : 264
    Language : English
    Location : UK

    Solved Re: "add friend" js code help

    Post by LGforum May 20th 2014, 12:02 am

    Sorry I don't visit this forum often.

    Try putting this for a wall link:
    Code:
    <a href="/profile?friend={postrow.displayed.POSTER}&mode=editprofile&page_profil=friendsfoes">Add as Friend</a>

    And try this for the wall:
    Code:
    <a href="/u{postrow.displayed.POSTER_ID}">Visit Wall</a>

    These are just intuitive guesses however.
    J0k3R^
    J0k3R^
    Forumember


    Male Posts : 742
    Reputation : 28
    Language : Greek > English > Russian > Spanish
    Location : C:\>r00t

    Solved Re: "add friend" js code help

    Post by J0k3R^ May 20th 2014, 6:24 am

    Thank you Smile
    it works fine

    $olved
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51499
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: "add friend" js code help

    Post by SLGray May 20th 2014, 7:07 am

    Topic Solved & Archived



    "add friend" js code help Slgray10

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

      Current date/time is September 24th 2024, 6:27 am