1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XenForo SDK 0.0.1

Software Development Kit

  1. Vincent Gabriel

    Vincent Gabriel Active Member

    Vincent.Gabriel submitted a new resource:

    XenForo SDK - Software Development Kit

    Read more about this resource...
     
    x3sphere and wmnitin like this.
  2. TBDragon

    TBDragon Active Member

    wow u read my mind bro i just wana come and write post for the login stuff on another script :p

    but i just wondring

    what i can do after login !!

    like can i get the group id of that user ? so the script will work just for those who in group ( 9,10 for example ) .,

    and thanks
     
  3. Vincent Gabriel

    Vincent Gabriel Active Member

    Not sure what you are looking to do but to get the group id of the current user (or any user) you can do:

    PHP:
    $user $sdk->getUser(); // or set an id getUser(12)
    echo $user['user_group_id'];
     
    TBDragon likes this.
  4. TBDragon

    TBDragon Active Member

    yes thats what i want ^_^ thanks very much
     
  5. xf_phantom

    xf_phantom Well-Known Member

    Nice one:)

    May i suggest to add following code to your constructor before you start the session:
    PHP:
    $dependencies = new XenForo_Dependencies_Public();
      
    $dependencies->preLoadData();
    Without this code, the event system won't be initialized
     
  6. Vincent Gabriel

    Vincent Gabriel Active Member

    Thank You, i'll get that added to the method.
     
    xf_phantom likes this.
  7. xf_phantom

    xf_phantom Well-Known Member

    Some improvement suggestions:
    verifyUsername /verifyEmail => copying the the DW code isn't the best solution, what if an addon changed the method? your sdk won't implement this changes,....
    it would be much better if you would use the DW to verify the data;)


    getUser()=> instead of returning the empty array, you could return the array from xenforo_model_user::getVisitingGuestUser (just to have 100% the same data like in XF)

    I had a similar helper class in the past, that's why i'm familiar with such problems:D

    Is this available on github?:whistle:
     
    Vincent Gabriel likes this.
  8. Vincent Gabriel

    Vincent Gabriel Active Member

    Some of the verify methods were throwing errors when i was trying to do that, suggestions/contributions are welcome. this is a WIP and first release will take some time to get it to a stable more robust version.

    https://github.com/VinceG/xenforo-sdk
     
    xf_phantom likes this.
  9. jesfro

    jesfro Member

    Sorry for my question...
    where [do i have to place] [can i use] the XenForoSDK.php?
     
  10. James

    James Well-Known Member

    You place it in the root of your forum.
     
  11. jesfro

    jesfro Member

    Ah, ok.

    Thank you!

    (y)
     
    Last edited: Jan 22, 2014
  12. LPH

    LPH Well-Known Member

    This is fantastic work. Congratulations.
     
  13. xf_phantom

    xf_phantom Well-Known Member

    James likes this.
  14. jesfro

    jesfro Member

    I would like to render a single thread (by threadId) in a widget (widget framwork). It should work as a normal thread with all ist comments.
     
  15. JackBiggin

    JackBiggin Member

    I'm probably completely overlooking something obvious here, so sorry for asking a potentially dumb question.

    I can get data for a user by ID using
    Code:
    $user = $sdk->getUser(54857);
    Is it possible for me to get data using their username, using something such as
    Code:
    $user = $sdk->getUser("JackBiggin");
    (I tried this and it didn't work, but suspect I'm simply using the wrong syntax).
     
  16. James

    James Well-Known Member

    No, the code only works based on ID. You could modify it if you wanted.
     
  17. RoyalRumble

    RoyalRumble Active Member

    Really nice resource thanks.

    But does anyone know how you can use the getThreads method to display the threads you want in the order that you want?

    On my website you'll see an Forum Box pulling latest threads, but its pulling the very first threads from 2007 as opposed to the very latest;

    This is what I'm currently using;

    Code:
                    <div id="frm-content" class="widget">
                        <div class="title">From The Forum</div>
                        <ul class="forum">
                            <?php
                                $threads = $xenforo->getThreads(array(), array('limit' => 10));
                               
                                function date_sort($a, $b) {
                                    return  $b['last_post_date'] - $a['last_post_date'];
                                }
                               
                                usort($threads, 'date_sort');
                               
                                foreach($threads as $thread) {
                                    echo('<li><a href="' . $CONF['site'] . '/forum/threads/' . urls($thread['title']) . '.'. $thread['thread_id'] .'">' . $thread['title'] . '</a></li>');
                                }
                            ?>
                        </ul>
                    </div>
     
  18. Smilie

    Smilie Member

    Anyone got the login methods working on 1.3?
    Specifically the login method (with or without validation) doesn't seems to be working for me. It returns the correct user id/true, but when I go to the forums I am not logged in :/
     
    Last edited: Jun 12, 2014
  19. David Herrgat

    David Herrgat New Member

    I'm having problems with : $output = $sdk->renderPublicTemplate('header', array $params); ... does not output anything
     
  20. Is this still up to date for 1.4?
     

Share This Page