Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Friends Extension intial developement old-

y2kbgy2kbg New
edited January 2007 in Vanilla 1.0 Help
Friends 1.0 Extension

read the description there

Comments

  • y2kbgy2kbg New
    edited December 2006
    OK new i idea, I will make it so that you can add people as friends(no request) and on the viewing page have three views, freinds, befriended, and mutual. i you add someone it goes under your friends and their befriended, when , or if they add you it will be taken off of both of those and added to mutual.

    what do you think?

    also here is my code to write to display the link on the account page and write to data base(i am pretty sure it wont do mch as of now as i have not tested it because my web host is still down. :(

    it is pretty much a very modified version of user wall thanks to pol for this
    as you can see there are still alot of wall references that need to be fixed.

    can someone that knows a little more fix this code up so that it works (and some unnecessary things can probably be removed)
    Newer code below
  • y2kbgy2kbg New
    edited December 2006
    code update :)

    even newer below
  • y2kbgy2kbg New
    edited January 2007
    <?php
    /*
    Extension Name: Friends
    Extension Url: ??
    Description: hahahaha
    Version: 1.0
    Author: Zak
    Author Url: zfiles.110mb.com
    */

    $Context->Dictionary['AddFriend'] = 'Add As Friend';
    //$Context->Dictionary[''] = '';



    if (!array_key_exists('friendssqlcheck', $Context->Configuration)) {
    $SQL = file_get_contents($Context->Configuration['EXTENSIONS_PATH'] . 'Friends/friends-mysql.sql');
    $Context->Database->Execute($SQL, 'Friends', NULL, 'Could not create Friends table');
    if ($Context->ErrorManager->Iif()) {
    AddConfigurationSetting($Context, 'friendssqlcheck', '1');
    }}


    if ($Context->SelfUrl == 'account.php' && ForceIncomingString('PostBackAction', '') == '') {
    class Friends extends Control {
    var $Posts;

    function Friends(&$Context) {
    $this->Name = 'Friends';
    $this->Control($Context);

    $NewFriendPost = ForceIncomingInt('u', $this->Context->Session->UserID);
    $friender = $this->Context->Session->UserID;
    if (($NewFriendPost = ForceIncomingString('friendid', ''))) {

    $result = mysql_query("INSERT INTO LUM_Friends(UserID, Friend) VALUES ('$friender', '$NewFriendPost')");
    if (!$result) {
    die('Invalid query: ' . mysql_error());
    }


    }
    }

    function Render() {
    $this->CallDelegate('PreRender');

    $FriendUserID = ForceIncomingInt('u', $this->Context->Session->UserID);
    $selfID = $this->Context->Session->UserID;

    $friends = mysql_query("SELECT Friend FROM LUM_Friends WHERE UserID = '$selfID'");
    if (!$friends) {
    die('Invalid query: ' . mysql_error());
    }
    $listoffriends = array();
    $listcount = '';
    while ($row = mysql_fetch_array($friends)) {
    $listoffriends[$listcount]= $row['Friend'];
    $listcount++;
    }


    if (in_array($FriendUserID, $listoffriends)) {
    echo "&nbspI am Your Friend";
    }
    else{


    echo '' . $this->Context->GetDefinition('AddFriend') . '';
    echo 'Context->Configuration, 'account.php', '', 'u', $FriendUserID) . '">';
    echo '

    ' . 'Cancel' . '

    ';
    }
    }
    }
    $Page->AddRenderControl($Context->ObjectFactory->NewContextObject($Context, 'Friends'), $Configuration['CONTROL_POSITION_BODY_ITEM']);
    }


    ?>
  • please.... stop talking to yourself....
  • I was hoping at least one person was following this because i am stuck right now....
  • y2kbgy2kbg New
    edited January 2007
    *above code has been updated*
    Ok i have got this to the point where:

    1. It creates the table correctly
    2. adds link and conformation submit button to the account pages
    3. when submit is clicked it attempts to write to database but i get this error:
    Affected Elements Friends.Friends(); The error occurred on or near: Table 'zfiles_vanillas.LUM_' doesn't exist
    I must be using the sqlbuilder wrong because it does not add my table name to the table name(as shown by the error message because it is just the prefix)

    If someone would tell me what i did wrong and what to do to fix this i would greatly appreciate it.

    I have updated the uploaded extension also and given a good screenshot too.

    http://lussumo.com/addons/index.php?PostBackAction=AddOn&AddOnID=234
  • OK i got it working, but i don't have the member extension modified to make a page for your friends yet.

    When you view an account you will see a link that says add as friend you will be asked to confirm and then once they are you friend it will say I am Your friend on there account.

    if anyone has ideas suggestions please say.

    http://lussumo.com/addons/index.php?PostBackAction=AddOn&AddOnID=234
  • ok if the wall disappears and reappears with the add to friends link only in ie7, jeeze i hate microsoft
  • neat , neat :)
  • so if the list have different names y does the on link control both of them, it work fine in FF....

    Does anyone know of a way to fix this?
  • well i should have the next version out within 3 days, having the members extension incorporated. It will all go under a tab called people and under that there will be four more tabs; my friends, two way friendships, people that have added me and all members. tell me if you figure out the first prob(above post) or want anything else added. i will also attempt to make a admin area in the near future(1 week and 3 days)
  • OK all done, added page to view friends. it coded pretty sloppy and un-user friendly right now but i hope to improve it.
  • You going to post a link to it then? ;)
  • well there is about three of the same link in above posts.... but here you go
    http://lussumo.com/addons/index.php?PostBackAction=AddOn&AddOnID=234
  • Ahhh, I was looking for a link-link, not just a link ;)

    For the lazy (like me) Friends 1.0 Extension.
  • check out this thread for recent updates

    Friends 1.0 Extension
This discussion has been closed.