Search

bbPress Showcase » WordPress Integration

  1. tikitakfire
    tikitakfire

    member
    Joined: May '08
    Posts: 16

    offline

    Hi everybody!

    I'm trying to integrate the WP and BBpress login with my application but I can so... can give me a hint to make cookie for my app, WP and BBpress?

    I see that after login get this:
    Array (
    [wordpress_logged_in_0c075535129bcbe9d6bcd335b9244e75] => admin|1224226518|9f96fe2267ca2fdc80d5193cb624ee3c
    )

    but, what are the data 0c075535129bcbe9d6bcd335b9244e75, 1224226518 and 9f96fe2267ca2fdc80d5193cb624ee3c

    Posted 3 years ago #
  2. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 884

    offline

    Oh you are trying to decode the cookie?

    You can find the cookie functions in pluggable.php

    Posted 3 years ago #
  3. tikitakfire
    tikitakfire

    member
    Joined: May '08
    Posts: 16

    offline

    well ... Now I know how to form the cookie but, when I make it, in WP and BBpress I'm not identified and can't login in bbpress.

    This is my directory structure:
    my-app/
    + bbpress/
    + wordpress/
    |-my.php
    |-app.php
    |-files.php

    My WordPress cookie integration speedup in bb-config.php
    $bb->wp_siteurl = 'http://localhost/jb/v2.0.1/blog';
    $bb->wp_home = 'http://localhost/jb/v2.0.1/blog';
    $bb->cookiedomain = '';
    $bb->cookiepath = '/jb/v2.0.1';
    $bb->authcookie = 'wordpress_0c075535129bcbe9d6bcd335b9244e75';
    $bb->secure_auth_cookie = 'wordpress_sec_0c075535129bcbe9d6bcd335b9244e75';
    $bb->logged_in_cookie = 'wordpress_logged_in_0c075535129bcbe9d6bcd335b9244e75';
    $bb->admin_cookie_path = '/jb/v2.0.1/foro/bb-admin';
    $bb->core_plugins_cookie_path = '/jb/v2.0.1/foro/bb-plugins';
    $bb->user_plugins_cookie_path = '/jb/v2.0.1/foro/my-plugins';
    $bb->sitecookiepath = '/jb/v2.0.1/blog';
    $bb->wp_admin_cookie_path = '/jb/v2.0.1/blog/wp-admin';
    $bb->wp_plugins_cookie_path = '/jb/v2.0.1/blog/wp-content/plugins';

    and the coockie:
    $expiration = time() + 172800;
    $expire = 0;
    $cookie = generate_auth_cookie($expiration);
    $domain = (empty($bb->cookiedomain)) ? $bb->cookiedomain : $bb->cookiedomain . '; HttpOnly';
    setcookie($bb->logged_in_cookie, $cookie, $expire, $bb->cookiepath, $bb->cookiedomain, $secure);

    Posted 3 years ago #
  4. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 884

    offline

    You can't externally create the cookie, bbPress or WordPress has to create it because of the secret keys. There is also one in the database table you don't typically have access to.

    What you can do however is simple load the bbpress core into your app to create the cookie, you don't even need to keep loading it, only the first time you see the visitor without the cookie.

    Simply do this to load the bbPress code into your other php app:

    require('/path-to-bbpress/bb-load.php');
    Posted 3 years ago #
  5. insightdesigns
    User has not uploaded an avatar

    new member
    Joined: Nov '08
    Posts: 1

    offline

    I'm trying to do the same thing, but I'm using CURL to simulate a POST operation to bb-login.php, capturing the header and setting the cookie manually using the values returned in the "Set-Cookie" portion of the header. The script is in the same directory of the same domain, but I'm still not logged in after running the script and attempting to access bbPress. Shouldn't this work - or am I missing something else?

    Thanks!

    Posted 3 years ago #
  6. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 884

    offline

    Don't use curl unless it's not on the same server. That's a ton of overhead.

    You should do what I showed above, including bb-load in your external script, which will authenticate the user and set the cookies.

    Posted 3 years ago #

RSS feed for this topic

Post a reply to “Cookies integration with my app”

You must log in to post.

keep _ck_ coding >> donate $5 <<     Theme Switcher:
29 users online from in the past 30 minutes. 14 bots 13 guests 2 members: mccawphoto, KitchenDip
7,381 views today 8,665 yesterday 14,010 peak. Most at once 63 today 48 yesterday 131 peak. Visited today: Dickinsonjohn9, shairah27, xiaotian, _ck_, engin1984, Augustine01, MichaelGomez, mccawphoto, KitchenDip
2,240 posts in 380 topics over 63 months by 425 of 1,992 members. Latest: shairah27, Augustine01, MichaelGomez