CuteNewsRU PHPBB3 Integration V1.0

Download plugins, language packs and stuff.

CuteNewsRU PHPBB3 Integration V1.0

Postby DarkSlim » Mon Nov 23, 2009 1:01 pm

Thanks to riri for leting me use his server for testing, I have made
a wonderful integration for CuteNewsRU with the new PHPBB3!! :)

What does it do?
- Lets you integrate your phpbb3 (forum) registration with cutenewsru, whenever a user
registers your phpbb forums he is -automatically- being registered over cutenewsru!
This is why you should also disable registration through cutenewsru alone (plus it
will stop spammers and bots registering).
- Registers the same username, nickname, password and email.
- If an error has occured it will show a matching error message, you can edit it as well.
- When the phpbb profile is updated the profile in cutenewsru is also updated
including email and passowrd!
- You should also not allow users in the forums or cutenewsru change their
nicknames alone (as if they change them only in one place there might be
a problem untill you change it in the other too, have not been tested yet).

Installation
1. Download the attached .rar file

2. Put the usr_registration.php file in your phpbb3_folder/includes/

3. Edit usr_registration.php and change the path to cutenewsru to the correct one
if it is not set right you will get an error.

You can also make the users entered to CNR as writers or editors (not recommended)
Just change it in the first lines (as it says in the file) and at the end there's another place.

Also if you want the script to check if the user is already existed in CNR and display
a message, uncomment the line (you will see the explenation in the file).

4. Open phpbb3_folder/includes/ucp/ucp_register.php

Find:
Code: Select all
   'user_ip'            => $user->ip,
               'user_regdate'         => time(),
               'user_inactive_reason'   => $user_inactive_reason,
               'user_inactive_time'   => $user_inactive_time,
            );


After Add:
Code: Select all
                                                          //DarkSlim's CuteNewsRU Integration
                                                           $usr_username = $data['username'];
                                                           $usr_password = $data['new_password'];
                                                           $username = $data['username'];
                                                           $email = $data['email'];


Then Find:
Code: Select all
               $message = $user->lang['ACCOUNT_ADDED'];
               $email_template = 'user_welcome';
            }


After Add:
Code: Select all
                                                          //DarkSlim's CuteNewsRU Integration
                                                           include($phpbb_root_path.'includes/usr_registration.'.$phpEx);


5. Close/Save the file, and Open phpbb3_folder/includes/ucp/ucp_profile.php

Find:
Code: Select all
   add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $data['username'],

$user->data['user_email'], $data['email']);
                  }


After Add:
Code: Select all
                                                                                        //DarkSlim's CuteNewsRU Integration                                                                                       
                                                                                         $usr_username =  $data['username'];
                                                                                         $usr_password = $data['new_password'];
                                                                                         $email = $data['email'];
                                                                                         $username = $data['username'];
                                                                                         include($phpbb_root_path.'includes/usr_registration.'.$phpEx);



6. Save all, upload files and test it.


That's it! hope it help, if I will have any updates the files will
be updated and this thread, I would love to hear if it all works
for you, what do you think and ideas to improve if you have. :)

DarkSlim
Attachments
CNR_PHPBB3_v1.0.rar
CuteNewsRU - PHPBB 3 Integration!
(2.02 KiB) Downloaded 140 times
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby riri » Mon Nov 23, 2009 1:15 pm

It's good work it!
thank you very much!
riri
 
Posts: 51
Joined: Tue Aug 21, 2007 8:32 pm

Postby liketobemad » Mon Nov 23, 2009 7:15 pm

Sounds good.. but it seems the existing users in forums will not be created in cutenews? Should database be coppied?
liketobemad
 
Posts: 36
Joined: Sun Sep 06, 2009 4:39 pm

Postby typeman » Tue Nov 24, 2009 1:07 am

Looks great! :D Thanks for posting!! :)

I have an idea:

Would it be possible to have a news bot and integrate it with CNR so whenever a new article is made, it's automatically added to the forum (like in it's own category)?

:)

Thanks 8)
typeman
 
Posts: 102
Joined: Sat Oct 17, 2009 7:38 am

Postby DarkSlim » Tue Nov 24, 2009 9:32 am

Thank you all! :)

Well, if you make a fresh install of both you will have all the users
from scratch, if not, yes you can copy the username/passowrd/email
from phpbb users table to the cutenewsru's users table

Also, I will try writing a code, that will get all the existing phpbb users into
cutenewsru or so, I will update you when I'll have it completed ;)

Typeman:
Hmm yeah I guess everything is possible, you just need to think on
how to do it, I have some more research to do with this all, so I might
as well check this option too. :)

DarkSlim
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby liketobemad » Tue Nov 24, 2009 6:33 pm

Thanks DarkSlim
additional features like a "combined panel for both forums and CNR " ; a login box on all the pages and if logged in links for logout and userpanel;
I will also try work on this and will inform of any updates.. though I don't have much hold of PHP :)
Keep Rocking
liketobemad
 
Posts: 36
Joined: Sun Sep 06, 2009 4:39 pm

Postby typeman » Thu Nov 26, 2009 6:58 pm

Hey, I have another suggestion :) Hopefully this won't prove too hard and I am sorry for always asking for help.

Would it possible to be able to have the avatar system linked up too? So you upload an avatar on the forums and it is the same on the CutenewsRU site?

Finally (sorry i'm a pain :P), can it be possible to use some tags outside of the forums on cutenewsru templates. So, for example, after a comment is left by user X, there's a link which can link users to their profile page.

Edit: Also, how about the PM system? Reckon you could incorporate that, too, so that it will show the user's PM count outside of the forums? :)

Edit 2: Uploaded and works like a charm! :D (the basic stuff anyway :))

Great job! :) i look forward to seeing if the above can be done :)
typeman
 
Posts: 102
Joined: Sat Oct 17, 2009 7:38 am

Postby typeman » Fri Nov 27, 2009 2:43 am

Right,

I was able to figure out intergrating PHPBB session IDs with a regular php page, so i'll post those fixes up a little later. Although the help on the avatar thing would still be appreciated :D

I'll post up a little guide on intergrating other PHPBB variables soon :)

Edit 2: I don't need the avatar thing anymore :) i figured out how you can display avatars uploaded to PhpBB onto any regular page. I'll share secrets in the morning :)
typeman
 
Posts: 102
Joined: Sat Oct 17, 2009 7:38 am

Postby DarkSlim » Fri Nov 27, 2009 8:09 am

Glad it works for you! :D

About a combined panel or so, I don't know if I'de recommend it, as phpbb has much more
options in it then CNR, plus the cutenews profile has more password, email etc' checks
and stuff, so (and that's what I'm doing) I would either have two profiles one for the
site and one for the forums (which are also linked - registering is done through the forum
and forum profile also updates site profile) or just use the forum profile to manage both
but you will be limited to password and email in CNR, it is possible to send some more
variables such as location, if I'll have the time I will post it here :)

I will try thinking of a way to update forum profile through the site too

I was thinking about using the avatar from the forum it should'nt be too hard
but the problem is that some of the avatars in my forums are pretty big so I have
a resize hack installed there, I know that there is also a resizeAvatar in CNR but
I really don't want to make the page load slower with huge avatars =\
So I would like to think of a way to check the size of the avatar, and if (for example)
it will be more that 150px - it will not show, and there will be a "blank" avatar or no
avatar at all
:o
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby typeman » Fri Nov 27, 2009 3:02 pm

A Quick Guide to Intergrating PHPBB3 Session IDs Into Regular Pages
(To Darkslim: If this guide is good enough, perhaps you could include it on the read me 8))

Step 1 - First and foremost, you must clear your exsisting PHPBB3 cache. If one still exists, then the coding will get out of hand and it quite simply won't work. You then will need to rename the cookie's name to "/"
Go to your ACP -> Cookie Settings and then change the cookie name to a forward hash "/".

Step 2 - Add the following code to the top of each and every page that will use the tags. (Before the <head> section)

Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './PATH_TO_FORUM/';    //Path to forum
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
?>


Replace PATH_TO_FORUM with the path to your PHPbb forum. REMEMBER, keep the "./" before the path as it will help with secruity.

That's it, you're done. You are now able to include all the phpbb tags onto your website.

Here's a few codes to get your started!

Display username if loged in, asks to sign up if not.
Code: Select all
<?php
if ($user->data['user_id'] == ANONYMOUS)
{
   echo 'Please <a href="register.php">register</a>';
}
else
{
   echo 'Welcome <strong>' .$user->data['username_clean'].'</strong>'
;
}
?>

Obvisouly replace "register.php" with the correct link.

Logout Link
Code: Select all
<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id). '">Log out</a>'


Login Box
Code: Select all
Please log in:<br />
<form method="POST" action="./PATH_TO_FORUMS/ucp.php?mode=login">
<p>Username: <input type="text" name="username" size="40"><br />
Password: <input type="password" name="password" size="40"><br />
Remember Me?: <input type="checkbox" name="autologin"><br />
<input type="submit" value="Submit" name="login"></p>
<input type="hidden" name="redirect" value="index.php">
</form>

And again, replace "PATH_TO_FORUMS" with the correct link.


There's also a lot of other functions which you can include on the coding too. To do so, simply put the tag name inside of the single quotes. E.g:
Code: Select all
.$user->data['username_clean'].

So here you would replace 'username_clean' with one of the values listed below.

* user_id - ID number of the user
* user_type - 2
* group_id - 1
* user_permissions - 00000000003khra6tc
i1cjyo000000
i1cjyo000000
* user_perm_from - 0
* user_ip -
* user_regdate - UNIX timestamp of the user's registration date
* username - user's username
* username_clean - clean version of the username
* user_password - MD5 encoded version of the user's password
* user_passchg - 0
* user_pass_convert - 0
* user_email - user's email address
* user_email_hash - 0
* user_birthday -
* user_lastvisit - 0
* user_lastmark - 0
* user_lastpost_time - 0
* user_lastpage -
* user_last_confirm_key -
* user_last_search - UNIX timestamp of the last search the user performed
* user_warnings - total number of warnings
* user_last_warning - UNIX timestamp of last warning
* user_login_attempts - number of login attempts this session
* user_inactive_reason - 0
* user_inactive_time - 0
* user_posts - total number of posts made by the user
* user_lang - user's language
* user_timezone - 0.00
* user_dst - 0
* user_dateformat - d M Y H:i
* user_style - 1
* user_rank - 0
* user_colour -
* user_new_privmsg - 0
* user_unread_privmsg - 0
* user_last_privmsg - 0
* user_message_rules - 0
* user_full_folder - -3
* user_emailtime - 0
* user_topic_show_days - 0
* user_topic_sortby_type - t
* user_topic_sortby_dir - d
* user_post_show_days - 0
* user_post_sortby_type - t
* user_post_sortby_dir - a
* user_notify - 0
* user_notify_pm - 1
* user_notify_type - 0
* user_allow_pm - 1
* user_allow_viewonline - 1
* user_allow_viewemail - 1
* user_allow_massemail - 0
* user_options - 895
* user_avatar -
* user_avatar_type - 0
* user_avatar_width - 0
* user_avatar_height - 0
* user_sig - the user's signature
* user_sig_bbcode_uid -
* user_sig_bbcode_bitfield -
* user_from - user's location
* user_icq - user's ICQ address
* user_aim - user's AIM address
* user_yim - user's Yahoo Messenger address
* user_msnm - user's MSN Live address
* user_jabber - user's Jabber address
* user_website - user's website
* user_occ - user's occupation
* user_interests -
* user_actkey -
* user_newpasswd -
* session_id - cf4eaea2eb0a0a1257bada05cd901ca7
* session_user_id - 1
* session_last_visit - UNIX timestamp of when the user last logged in
* session_start - UNIX timestamp of when the user logged in
* session_time - UNIX timestamp of the last time the user clicked on a page
* session_ip - current IP address
* session_browser - Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7
* session_forwarded_for -
* session_page - test.php
* session_viewonline - 1
* session_autologin - 0
* session_admin - 0
* is_registered -
* is_bot -

[Full list found [url="http://www.phpbb.com/kb/article/phpbb3-sessions-integration/"]here[/url]]


    Thanks to Darkslim, CutenewsRU has been opened up to a LOT more things and costumisation. Hopefully my short guide has given you a slight insight into the possabilities of using the phpBB ID sessions. I'll be sure to update and help anyone with it. :)
    Last edited by typeman on Sat Nov 28, 2009 12:14 am, edited 1 time in total.
    typeman
     
    Posts: 102
    Joined: Sat Oct 17, 2009 7:38 am

    Postby Torstein » Fri Nov 27, 2009 10:25 pm

    I think a few of us have been wanting this feature for quite some time, nice to finally see it realized. 8)

    Since I don't have enough time to fiddle around with CuteNews.RU at the time, and since I guess it will be asked sooner or later:
    how would one go about copying existing users from CuteNews.RU into a new phpBB3 installation?
    Torstein
     
    Posts: 292
    Joined: Thu Aug 03, 2006 11:19 pm

    Postby DarkSlim » Sat Nov 28, 2009 10:34 am

    Torstein wrote:I think a few of us have been wanting this feature for quite some time, nice to finally see it realized. 8)

    Since I don't have enough time to fiddle around with CuteNews.RU at the time, and since I guess it will be asked sooner or later:
    how would one go about copying existing users from CuteNews.RU into a new phpBB3 installation?


    Oh right. it has been asked, well I'll check it rir's installtions are still
    working as I am not using phpbb3 myself, and I will try make a code
    for it when I'll have time the next days or so :)
    User avatar
    DarkSlim
     
    Posts: 298
    Joined: Thu Aug 06, 2009 4:18 pm
    Location: IL

    Postby typeman » Sun Nov 29, 2009 1:04 am

    Well, this is embarrassing... :oops: :oops: :oops: :oops: :oops:

    In the rush to try out new session IDs, I forgot to even test it with Cutenews PHP scripts running in it. :oops: :?

    And, as you can probably guess, it didn't want any of it. The two wouldn't collide, so I was hoping that someone could help get both running at the same time :D

    This is currently what I have at the top of my page:

    Code: Select all
    <?php include('cutenews/head.php'); ?>
    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = './forums/';    //Path to forum
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup('ucp');
    ?>


    And this is the error I'm getting in return :(

    Code: Select all
    Catchable fatal error: Object of class user could not be converted to string in /home/baxyzco1/public_html/cat3/cutenews/inc/show.news.php on line 24



    Thanks a lot! :D
    typeman
     
    Posts: 102
    Joined: Sat Oct 17, 2009 7:38 am

    Postby typeman » Wed Dec 02, 2009 6:38 pm

    Just wondered if anyone has had the time to look at this yet :)
    typeman
     
    Posts: 102
    Joined: Sat Oct 17, 2009 7:38 am

    Postby typeman » Fri Dec 18, 2009 11:37 pm

    Great news! Someone from the official PHPBB forums was able to help me out with a fix. I'll post it up tomorrow when I have time :)
    typeman
     
    Posts: 102
    Joined: Sat Oct 17, 2009 7:38 am

    Next

    Return to Additional Downloads



    Who is online

    Users browsing this forum: No registered users and 0 guests

    cron