Recent Topics

1 Apr 07, 2008 00:38    

Hi! This is my first post on this forum, hope it helps!

I'm going to use b2evo on a project, and I needed blog automatic creation when an user registers.

I knew about [url=http://forums.b2evolution.net/viewtopic.php?t=8146]autoblog plugin[/url] by Fralenuvol, but it seems not to be compatible with b2evo v2.x. Also, the plugin isn't avaliable on the download page. Yesterday I sent a mail to the creator, but can't get an awnser.

Today I continued searching, and then I found this thread. The issue is that EdB forgot to say his hack is only for the early versions (his posts are from August 2005! 8| ) So I decided to modify them to make it compatible with b2evo v2.x

[u]Here is the modified version:[/u]
As him, I have separated the hack into two parts, with two files to be modified:

On skins_admin/login/_req_form.main.php
around line 49, search for:


$Form->begin_fieldset();

$Form->text_input( 'login', $login, 16,  T_('Login'), '', array( 'maxlength'=>20, 'class'= >'input_text', 'required'=>true ) );

And replace with:


// ### Hack for getting a blog when user registers [Step 1] ###
// Login/Username can't be more than 12 characters
?>
<fieldset id="ffield_login" >
<div class="label"><label for="login"><?php echo T_('Login') ?></label></div>
<div class="input"><input maxlength="12" class="input_text form_text_input field_required" size="16" type="text" name="login" id="login" value="<?php echo $login ?>" />
<span class="notes"><?php echo T_('Maximum 12 characters, please.') ?></span>
</div>
</fieldset>
<?php
// ### End of Step 1 ###

On htsrv/register.php
around line 157, search for:


locale_temp_switch( $AdminUser->get( 'locale' ) );
      
$message  = T_('New user registration on your blog').":\n"

And between the lines, in the blank one, just add:


// ### Hack for getting a blog when user registers [Step 2] ###
// Creating a blog for the new user, and aplying preferences

			$new_blog_stub = $new_User->login;
			$new_blog_locale = $new_User->locale;
			$new_blog_name = $new_blog_stub. ' Blog';


			// get the new blogger ID number
			$query = "SELECT user_ID from T_users WHERE user_login = ";
			$query .= "'".$DB->escape($new_blog_stub)."'";
			$new_blogger_ID = $DB->get_var($query);
			
			
			// create the new blog
			echo '<p>Creating blog for '.$new_blog_stub.'...</p>';
			$query = "INSERT INTO T_blogs ( ";
			$query .= "blog_tagline, ";
			$query .= "blog_longdesc, ";
			$query .= "blog_notes, ";
			$query .= "blog_urlname, ";
			$query .= "blog_name, ";
			$query .= "blog_owner_user_ID, ";
			$query .= "blog_shortname, ";
			$query .= "blog_description, ";
			$query .= "blog_locale ) ";
			$query .= "VALUES ( ";
			$query .= "'A new Blog for a new Blogger', ";
			$query .= "'This is the long description of your blog.', ";
			$query .= "'This is a note about your blog.', ";
			$query .= "'".$DB->escape($new_blog_stub)."', ";
			$query .= "'".$DB->escape($new_blog_name)."', ";
			$query .= "'".$DB->escape($new_blogger_ID)."', ";
			$query .= "'".$DB->escape($new_blog_stub)."', ";
			$query .= "'This is the description field.', ";
			$query .= "'".$DB->escape($new_blog_locale)."' )";
			$DB->query( $query );

			// get the new blog ID number
			$query = "SELECT blog_ID from T_blogs WHERE blog_urlname = ";
			$query .= "'".$DB->escape($new_blog_stub)."'";
			$new_blog_ID = $DB->get_var($query);

			// Set new blogger permissions for the new blog
			echo '<p>Activating permissions for '.$new_blog_stub.' on '.$new_blog_stub.'...</p>';
			$query = "INSERT INTO T_coll_user_perms ( ";
			$query .= "bloguser_blog_ID, ";
			$query .= "bloguser_user_ID, ";
			$query .= "bloguser_ismember, ";
			$query .= "bloguser_perm_poststatuses, ";
			$query .= "bloguser_perm_delpost, ";
			$query .= "bloguser_perm_edit, ";
			$query .= "bloguser_perm_comments, ";
			$query .= "bloguser_perm_cats, "; 
			$query .= "bloguser_perm_media_upload, ";
			$query .= "bloguser_perm_media_browse, ";
			$query .= "bloguser_perm_properties ) ";
			$query .= "VALUES ( ";
			$query .= "'".$DB->escape($new_blog_ID)."', ";
			$query .= "'".$DB->escape($new_blogger_ID)."', ";
			$query .= "1, 'published,protected,private,draft,deprecated', 1, 1, 1, 1, 1, 1, 1 )";
			$DB->query( $query );

			param( 'redirect_to', 'string', $admin_url.'/b2edit.php?blog='.$new_blog_ID );
			// that was the hack
// ### End of Step 2 ###

All that I did was some re-code the first part for the login field and, on the second part of the hack, I updated the variables ($tableblog is not longer used, now using T_blog instead, and so...)
Also, I disabled the creation of a category for the new blog. At 2.x users can create their own categories.

I couldn't found the Autoblog plugin source, so I can develope a plugin for this hack. (I haven't read plugin dev. docs though :oops: )
By the way, this hack is really simple, but if someone have any issue, feel free to post your questions and/or suggestions.

2 Apr 07, 2008 00:43

Hi YTQM.org

Welcome to the forums.

First thing I did was split your post from the [url=http://forums.b2evolution.net/viewtopic.php?t=5042[/url]ancient post by EdB[/url] because that one is really to old ;) and this topic deserves a thread of it's own.

Unfortunately the autoblog plugin is one of the few that are left to be converted to 2.4.1. In this case it means grossly a rewrite of the plugin and that's what 't bothering the developers.

Thanks for your efforts. I will review your hack when I find time to do so. Likely others will beat me at that.

Good luck

(20 reputation points for your very first post, how about that?)

3 Apr 07, 2008 00:54

Oh, I thought replying the post was the correct way. But yes, I know that could stay as a new thread.

Developing the hack was easy with OpenSuse+Gnome (I see your signature LOL)

Thanks for the reputation. Also, if someone has the source of the autoblog plugin, let me know, because now that I know how b2evo works, I could give it a try.

4 Apr 07, 2008 01:09

Hmmm... When I saw that old thread had a reply I thought "why would someone dig that thing up" but then the content made it very clear why. This new version is exactly and directly related to the old one yah? Digging up an oldie to say "this doesn't work in the new version" is obnoxious, but digging it up to say "since this doesn't work in the new version so I made it work and here you go" seems okay to me.

Either reply or create new: no worries. Nice to see someone doing an "auto blog" feature for the next generation!

6 Apr 08, 2008 19:09

Hi Everyone,
I'm a little new to B2Evolution and will be installing it tonight on our server. The number one reason we are looking at it is this post :) So keep up the good work. I'll see if I can lend a hand on the plugin once I get it installed this evening and get to play around with it.

Dapanther

7 Apr 08, 2008 23:58

Hi dapanther. Welcome to the forums. That plugin is known to work in older versions, but does not work in the latest stable release (2.4.1) so if you're using the new stuff expect it to not be your friend.

I hate to say it because it will be a very hard task anyway, but if you're good with php stuff you might want to install 1.10.3 with this plugin and get to know how the plugin manipulated the core files, then apply that knowledge to a 2.4.1 installation. It seems YTQM.org has provided a head start by getting a hack together so that's good yah?

Best of luck with this to all who are trying. It is very far outside the intended application of b2evolution, but a very popular thing once it works.

8 Apr 09, 2008 02:33

EdB,
Actually, I use iWeb as my host and they have version 1.10.3 installed through Fantastico so I'll probably use the older version for now and then when the plugin gets rewritten or I get bored :) I'll look at 2.4.(X probably by then) :)

Dapanther

9 Apr 13, 2008 13:59

Ok. After a week fighting with the plugin, I left it. It's a bit complex, and it breaks for many many places.
Altough, I re-write my hack for security issues.

On the first version of the hack (the one you can see at the first post of this thread) blog creation is made when user registers. What about bots?

Think of this: a funny bored bot is searching the internet, and find your registration form. Then he starts to make registrations. A lot of them. How much time it will need to drop your SQL? Bets welcome ;)

So, I decided to give users a blog BEFORE they validate the mail address. As a security issue this way is a bit strong.

This hack starts with a clean instalation, so if you have set up my previous hack, you'll need to restore the modified files...because, you have a backup, right? :D

C'mon, let's start the magic!

This hack need to edit 3 files:

On skins_admin/login/_req_form.main.php
around line 49, search for:

$Form->begin_fieldset();

$Form->text_input( 'login', $login, 16,  T_('Login'), '', array( 'maxlength'=>20, 'class'= >'input_text', 'required'=>true ) );

And replace with:

// ### Hack for getting a blog when user registers v.2 [Step 1] ###
// Login/Username can't be more than 12 characters
?>
<fieldset id="ffield_login" >
<div class="label"><label for="login"><?php echo T_('Login') ?></label></div>
<div class="input"><input maxlength="12" class="input_text form_text_input field_required" size="16" type="text" name="login" id="login" value="<?php echo $login ?>" />
<span class="notes"><?php echo T_('Maximum 12 characters, please.') ?></span>
</div>
</fieldset>
<?php
// ### End of Step 1 ###


Actually I don't know if this is necessary, but it's safer.

On /inc/users/model/_user.class.php
from line 1116 to line 1121 find:

			."\n"
			.$htsrv_url_sensitive.'login.php?action=validatemail'
				.'&reqID='.$request_id
				.'&sessID='.$Session->ID  // used to detect cookie problems
			."\n\n"
			.T_('Please note:')

and replace all with:

// ### Hack for getting a blog when user registers v.2 [Step 2] ###
			."\n\n"
			.T_('Important Notice')
			."\n"
			.'--------------------------------'
			."\n"
			.T_('If you like to receive a blog with your registration, please use the next link:')
			."\n"
			.$htsrv_url_sensitive.'login.php?action=validatemail'
				.'&reqID='.$request_id
				.'&sessID='.$Session->ID  // used to detect cookie problems
				.'&nuevoBlog=si'
			."\n\n"
			.T_('If you just want to register WITHOUT getting a blog, folow this link:')
			."\n"
			.$htsrv_url_sensitive.'login.php?action=validatemail'
				.'&reqID='.$request_id
				.'&sessID='.$Session->ID  // used to detect cookie problems
			."\n\n"
			.T_('Please note:')
// ### End of Step 2 ###

on /htsrv/login.php
at line 238 find:

// validate user

And just below, add:

// ### Hack for getting a blog when user registers v.2 [Step 3] ###
			// & create blog for the user, if he click on the correct link
			$nuevoBlog = $_GET['nuevoBlog'];
			if( $nuevoBlog == 'si' )
			{  // if user clicked on the 1st link, give them a blog!
				
				// Starting SQL
				$DB->begin();
				
				// this is the hack
				$new_blog_stub = $current_User->login;
				$new_blog_locale = $current_User->locale;
				$new_blog_name = 'Blog de '.$new_blog_stub;


				// get the new blogger ID number
				$query = "SELECT user_ID from T_users WHERE user_login = ";
				$query .= "'".$DB->escape($new_blog_stub)."'";
				$new_blogger_ID = $DB->get_var($query);
				
				
				// create the new blog
				echo '<p>Creando blog para '.$new_blog_stub.'...</p>';
				$query = "INSERT INTO T_blogs ( ";
				$query .= "blog_tagline, ";
				$query .= "blog_longdesc, ";
				$query .= "blog_notes, ";
				$query .= "blog_urlname, ";
				$query .= "blog_name, ";
				$query .= "blog_owner_user_ID, ";
				$query .= "blog_shortname, ";
				$query .= "blog_description, ";
				$query .= "blog_locale ) ";
				$query .= "VALUES ( ";
				$query .= "'Un nuevo blog para un nuevo blogger', ";
				$query .= "'Esto es la descripcion larga para tu blog.', ";
				$query .= "'Esto es una nota para tu blog.', ";
				$query .= "'".$DB->escape($new_blog_stub)."', ";
				$query .= "'".$DB->escape($new_blog_name)."', ";
				$query .= "'".$DB->escape($new_blogger_ID)."', ";
				$query .= "'".$DB->escape($new_blog_stub)."', ";
				$query .= "'Este es el campo de descripcion.', ";
				$query .= "'".$DB->escape($new_blog_locale)."' )";
				$DB->query( $query );

				// get the new blog ID number
				$query = "SELECT blog_ID from T_blogs WHERE blog_urlname = ";
				$query .= "'".$DB->escape($new_blog_stub)."'";
				$new_blog_ID = $DB->get_var($query);

				// Set new blogger permissions for the new blog
				echo '<p>Activando permisos para '.$new_blog_stub.' en el blog de '.$new_blog_stub.'...</p>';
				$query = "INSERT INTO T_coll_user_perms ( ";
				$query .= "bloguser_blog_ID, ";
				$query .= "bloguser_user_ID, ";
				$query .= "bloguser_ismember, ";
				$query .= "bloguser_perm_poststatuses, ";
				$query .= "bloguser_perm_delpost, ";
				$query .= "bloguser_perm_edit, ";
				$query .= "bloguser_perm_comments, ";
				$query .= "bloguser_perm_cats, "; 
				$query .= "bloguser_perm_media_upload, ";
				$query .= "bloguser_perm_media_browse, ";
				$query .= "bloguser_perm_properties ) ";
				$query .= "VALUES ( ";
				$query .= "'".$DB->escape($new_blog_ID)."', ";
				$query .= "'".$DB->escape($new_blogger_ID)."', ";
				$query .= "1, 'published,protected,private,draft,deprecated', 1, 1, 1, 1, 1, 1, 1 )";
				$DB->query( $query );

				//ending SQL
				$DB->commit();
				
				// that was the hack
	    					
			}
// ### End of Step 3 ###

This hack send the validation mail with two links on it. If user wants a blog, he/she has to click on the first link, if he/she doesn't want it, then they use the second link.
As I added some text, you may want to translate to your own language. To do it, just edit your locale _global.php file.

Hope this helps again. Any suggestions/bugs/requests are welcome!

PS: Reputation is new to me. But i like it :). So, if you like this hack, just click on the green plus icon next to the starts below my name. Thanks!

10 Apr 24, 2008 15:18

Greetings. At me a problem. Following mistakes show:

Creando blog para test...

Activando permisos para test en el blog de test...


Warning: Cannot modify header information - headers already sent by (output started at /www/swworld/users/swworld-blogs/www/htdocs/htsrv/login.php:261) in /www/swworld/users/swworld-blogs/www/htdocs/inc/_core/_template.funcs.php on line 146

Warning: Cannot modify header information - headers already sent by (output started at /www/swworld/users/swworld-blogs/www/htdocs/htsrv/login.php:261) in /www/swworld/users/swworld-blogs/www/htdocs/inc/_core/_template.funcs.php on line 147

Warning: Cannot modify header information - headers already sent by (output started at /www/swworld/users/swworld-blogs/www/htdocs/htsrv/login.php:261) in /www/swworld/users/swworld-blogs/www/htdocs/inc/_core/_template.funcs.php on line 148

Warning: Cannot modify header information - headers already sent by (output started at /www/swworld/users/swworld-blogs/www/htdocs/htsrv/login.php:261) in /www/swworld/users/swworld-blogs/www/htdocs/inc/_core/_template.funcs.php on line 149

Warning: Cannot modify header information - headers already sent by (output started at /www/swworld/users/swworld-blogs/www/htdocs/htsrv/login.php:261) in /www/swworld/users/swworld-blogs/www/htdocs/inc/_core/_template.funcs.php on line 133

Warning: Cannot modify header information - headers already sent by (output started at /www/swworld/users/swworld-blogs/www/htdocs/htsrv/login.php:261) in /www/swworld/users/swworld-blogs/www/htdocs/inc/_core/_template.funcs.php on line 136


But after that блог at the user it is created. The coding - UTF8 without BOM

11 Apr 24, 2008 17:06

Mmmm, is strange...

I say it's strange because on my hack no header is sent.

By the way, check there's no mispelling when typing my hack, and it will be usefull you can type, for example, from the line 250 to 280 at htsrv/login.php

12 Apr 27, 2008 13:59

YTQM.org wrote:

Mmmm, is strange...

I say it's strange because on my hack no header is sent.

By the way, check there's no mispelling when typing my hack, and it will be usefull you can type, for example, from the line 250 to 280 at htsrv/login.php

I have made these changes not once and is assured, that have edited correctly. At me the Russian version b2evolution is established. If you still will answer, you could not write in simple English which the electronic translator can understand. I English do not know.

line 250 to 280 at

$new_blog_locale = $current_User->locale;
            $new_blog_name = 'Blog de '.$new_blog_stub;


            // get the new blogger ID number
            $query = "SELECT user_ID from T_users WHERE user_login = ";
            $query .= "'".$DB->escape($new_blog_stub)."'";
            $new_blogger_ID = $DB->get_var($query);
            
            
            // create the new blog
            echo '<p>Creando blog para '.$new_blog_stub.'...</p>';
            $query = "INSERT INTO T_blogs ( ";
            $query .= "blog_tagline, ";
            $query .= "blog_longdesc, ";
            $query .= "blog_notes, ";
            $query .= "blog_urlname, ";
            $query .= "blog_name, ";
            $query .= "blog_owner_user_ID, ";
            $query .= "blog_shortname, ";
            $query .= "blog_description, ";
            $query .= "blog_locale ) ";
            $query .= "VALUES ( ";
            $query .= "'Un nuevo blog para un nuevo blogger', ";
            $query .= "'Esto es la descripcion larga para tu blog.', ";
            $query .= "'Esto es una nota para tu blog.', ";
            $query .= "'".$DB->escape($new_blog_stub)."', ";
            $query .= "'".$DB->escape($new_blog_name)."', ";
            $query .= "'".$DB->escape($new_blogger_ID)."', ";
            $query .= "'".$DB->escape($new_blog_stub)."', ";
            $query .= "'Este es el campo de descripcion.', ";

13 May 10, 2008 19:26

YTQM.org wrote:

Mmmm, is strange...

I say it's strange because on my hack no header is sent.

By the way, check there's no mispelling when typing my hack, and it will be usefull you can type, for example, from the line 250 to 280 at htsrv/login.php

It's my first time on this forums...

I had the same situation as blaster, so I read the line 250 to 280 at htsrv/login.php

And I found that.......
The name of tables that in query statement are different with mine.

My version of B2evolution is 2.4.2, and the default prefix of naming in database is evo_xxxx

By this reason, I modify the code like below

// ### Hack for getting a blog when user registers v.2 [Step 3] ###
         // & create blog for the user, if he click on the correct link
         $nuevoBlog = $_GET['nuevoBlog'];
         if( $nuevoBlog == 'si' )
         {  // if user clicked on the 1st link, give them a blog!
            
            // Starting SQL
            $DB->begin();
            
            // this is the hack
            $new_blog_stub = $current_User->login;
            $new_blog_locale = $current_User->locale;
            $new_blog_name = 'Blog de '.$new_blog_stub;


            // get the new blogger ID number
            $query = "SELECT user_ID from evo_users WHERE user_login = ";
            $query .= "'".$DB->escape($new_blog_stub)."'";
            $new_blogger_ID = $DB->get_var($query);
            
            
            // create the new blog
            echo '<p>Creando blog para '.$new_blog_stub.'...</p>';
            $query = "INSERT INTO evo_blogs ( ";
            $query .= "blog_tagline, ";
            $query .= "blog_longdesc, ";
            $query .= "blog_notes, ";
            $query .= "blog_urlname, ";
            $query .= "blog_name, ";
            $query .= "blog_owner_user_ID, ";
            $query .= "blog_shortname, ";
            $query .= "blog_description, ";
            $query .= "blog_locale ) ";
            $query .= "VALUES ( ";
            $query .= "'Un nuevo blog para un nuevo blogger', ";
            $query .= "'Esto es la descripcion larga para tu blog.', ";
            $query .= "'Esto es una nota para tu blog.', ";
            $query .= "'".$DB->escape($new_blog_stub)."', ";
            $query .= "'".$DB->escape($new_blog_name)."', ";
            $query .= "'".$DB->escape($new_blogger_ID)."', ";
            $query .= "'".$DB->escape($new_blog_stub)."', ";
            $query .= "'Este es el campo de descripcion.', ";
            $query .= "'".$DB->escape($new_blog_locale)."' )";
            $DB->query( $query );

            // get the new blog ID number
            $query = "SELECT blog_ID from evo_blogs WHERE blog_urlname = ";
            $query .= "'".$DB->escape($new_blog_stub)."'";
            $new_blog_ID = $DB->get_var($query);

            // Set new blogger permissions for the new blog
            echo '<p>Activando permisos para '.$new_blog_stub.' en el blog de '.$new_blog_stub.'...</p>';
            $query = "INSERT INTO evo_blogusers ( ";
            $query .= "bloguser_blog_ID, ";
            $query .= "bloguser_user_ID, ";
            $query .= "bloguser_ismember, ";
            $query .= "bloguser_perm_poststatuses, ";
            $query .= "bloguser_perm_delpost, ";
            $query .= "bloguser_perm_edit, ";
            $query .= "bloguser_perm_comments, ";
            $query .= "bloguser_perm_cats, ";
            $query .= "bloguser_perm_media_upload, ";
            $query .= "bloguser_perm_media_browse, ";
            $query .= "bloguser_perm_properties ) ";
            $query .= "VALUES ( ";
            $query .= "'".$DB->escape($new_blog_ID)."', ";
            $query .= "'".$DB->escape($new_blogger_ID)."', ";
            $query .= "1, 'published,protected,private,draft,deprecated', 1, 1, 1, 1, 1, 1, 1 )";
            $DB->query( $query );

            //ending SQL
            $DB->commit();
            
            // that was the hack
                      
         }
// ### End of Step 3 ### 

And my b2evolution works now.....

I do not know PHP programing( :'( I am a J2EE programer), so cannot code it more batter, like depend on user's setting in the installing......

Hope that is useful for someone like blaster

14 May 12, 2008 20:30

Sorry for that.....

I miss some modifies on the last post....

And I post a more better code, and please try it again......

I cannot make sure that is safe or not, but it really works now!

If that is unsafe, please tell me....thanks a lot......

on skins_admin/login/_req_form.main.php
around line 49, search for:

$Form->begin_fieldset();

$Form->text_input( 'login', $login, 16,  T_('Login'), '', array( 'maxlength'=>20, 'class'= >'input_text', 'required'=>true ) );

and replace with:

// ### Hack for getting a blog when user registers v.2 [Step 1] ###
// Login/Username can't be more than 12 characters
?>
<fieldset id="ffield_login" >
<div class="label"><label for="login"><?php echo T_('Login') ?></label></div>
<div class="input"><input maxlength="12" class="input_text form_text_input field_required" size="16" type="text" name="login" id="login" value="<?php echo $login ?>" />
<span class="notes"><?php echo T_('Maximum 12 characters, please.') ?></span>
</div>
</fieldset>
<?php
// ### End of Step 1 ### 

then on /inc/users/model/_user.class.php
from line 1116 to line 1121 find:

."\n"
         .$htsrv_url_sensitive.'login.php?action=validatemail'
            .'&reqID='.$request_id
            .'&sessID='.$Session->ID  // used to detect cookie problems
         ."\n\n"
         .T_('Please note:') 

and replace all with:

// ### Hack for getting a blog when user registers v.2 [Step 2] ###
         ."\n\n"
         .T_('Important Notice')
         ."\n"
         .'--------------------------------'
         ."\n"
         .T_('If you like to receive a blog with your registration, please use the next link:')
         ."\n"
         .$htsrv_url_sensitive.'login.php?action=validatemail'
            .'&reqID='.$request_id
            .'&sessID='.$Session->ID  // used to detect cookie problems
            .'&nuevoBlog=si'
         ."\n\n"
         .T_('If you just want to register WITHOUT getting a blog, folow this link:')
         ."\n"
         .$htsrv_url_sensitive.'login.php?action=validatemail'
            .'&reqID='.$request_id
            .'&sessID='.$Session->ID  // used to detect cookie problems
         ."\n\n"
         .T_('Please note:')
// ### End of Step 2 ### 

on /htsrv/login.php
at line 238 find:

// Validate user:

And just below, add:

// ### Hack for getting a blog when user registers v.2 [Step 3] ### 
         // & create blog for the user, if he click on the correct link 
         // validate $_GET['nuevoBlog'] is null or not, null do nothings
         if(isset($_GET['nuevoBlog'] ))
         {
          $nuevoBlog = $_GET['nuevoBlog']; 
         if( $nuevoBlog == 'si' ) 
         {  // if user clicked on the 1st link, give them a blog! 
             
            // Starting SQL 
            $DB->begin(); 
             
            // this is the hack 
            $new_blog_stub = $current_User->login; 
            $new_blog_locale = $current_User->locale; 
            $new_blog_name = 'Blog de '.$new_blog_stub; 


            // get the new blogger ID number 
            $query = "SELECT user_ID from evo_users WHERE user_login = "; 
            $query .= "'".$DB->escape($new_blog_stub)."'"; 
            $new_blogger_ID = $DB->get_var($query); 
             
             
            // create the new blog 
            //echo '<p>Creando blog para '.$new_blog_stub.'...</p>'; 
            $query = "INSERT INTO evo_blogs ( "; 
            $query .= "blog_tagline, "; 
            $query .= "blog_longdesc, "; 
            $query .= "blog_notes, "; 
            $query .= "blog_urlname, "; 
            $query .= "blog_name, "; 
            $query .= "blog_owner_user_ID, "; 
            $query .= "blog_shortname, "; 
            $query .= "blog_description, "; 
            $query .= "blog_locale ) "; 
            $query .= "VALUES ( "; 
            $query .= "'Un nuevo blog para un nuevo blogger', "; 
            $query .= "'Esto es la descripcion larga para tu blog.', "; 
            $query .= "'Esto es una nota para tu blog.', "; 
            $query .= "'".$DB->escape($new_blog_stub)."', "; 
            $query .= "'".$DB->escape($new_blog_name)."', "; 
            $query .= "'".$DB->escape($new_blogger_ID)."', "; 
            $query .= "'".$DB->escape($new_blog_stub)."', "; 
            $query .= "'Este es el campo de descripcion.', "; 
            $query .= "'".$DB->escape($new_blog_locale)."' )"; 
            $DB->query( $query ); 

            // get the new blog ID number 
            $query = "SELECT blog_ID from evo_blogs WHERE blog_urlname = "; 
            $query .= "'".$DB->escape($new_blog_stub)."'"; 
            $new_blog_ID = $DB->get_var($query); 

            // Set new blogger permissions for the new blog 
           //echo '<p>Activando permisos para '.$new_blog_stub.' en el blog de '.$new_blog_stub.'...</p>'; 
            $query = "INSERT INTO evo_blogusers ( "; 
            $query .= "bloguser_blog_ID, "; 
            $query .= "bloguser_user_ID, "; 
            $query .= "bloguser_ismember, "; 
            $query .= "bloguser_perm_poststatuses, "; 
            $query .= "bloguser_perm_edit, "; 
            $query .= "bloguser_perm_delpost, "; 
            $query .= "bloguser_perm_comments, "; 
            $query .= "bloguser_perm_cats, "; 
            $query .= "bloguser_perm_properties, "; 
            $query .= "bloguser_perm_admin, "; 
            $query .= "bloguser_perm_media_upload, "; 
            $query .= "bloguser_perm_media_browse, "; 
            $query .= "bloguser_perm_media_change) "; 
            $query .= "VALUES ( "; 
            $query .= "'".$DB->escape($new_blog_ID)."', "; 
            $query .= "'".$DB->escape($new_blogger_ID)."', "; 
            $query .= "1, 'published,protected,private,draft,deprecated', 1, 1, 1, 1, 1, 1, 1, 1, 1 )"; 
            $DB->query( $query ); 

            //ending SQL 
            $DB->commit(); 
             
            // that was the hack 
                       
         } 
        }
// ### End of Step 3 ### 

and on /inc/_core/_template.funcs.php
from line 130 to line 150 find:

	else
	{	// This should be a "follow up" redirect
		// Note: Also see http://de3.php.net/manual/en/function.header.php#50588 and the other comments around
		header( 'HTTP/1.1 303 See Other' );
	}

	header( 'Location: '.$redirect_to, true, $status ); // explictly setting the status is required for (fast)cgi
	exit();
}


/**
 * Sends HTTP headers to avoid caching of the page.
 */
function header_nocache()
{
	header('Expires: Tue, 25 Mar 2003 05:00:00 GMT');
	header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
	header('Cache-Control: no-cache, must-revalidate');
	header('Pragma: no-cache');
}

and replace all with:

	else
// ### Hack for getting a blog when user registers v.2 [Step 4] ### 
	{	// This should be a "follow up" redirect
		// Note: Also see http://de3.php.net/manual/en/function.header.php#50588 and the other comments around
		@header( 'HTTP/1.1 303 See Other' );
	}

	@header( 'Location: '.$redirect_to, true, $status ); // explictly setting the status is required for (fast)cgi
	exit();
}


/**
 * Sends HTTP headers to avoid caching of the page.
 */
function header_nocache()
{
	@header('Expires: Tue, 25 Mar 2003 05:00:00 GMT');
	@header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
	@header('Cache-Control: no-cache, must-revalidate');
	@header('Pragma: no-cache');
}
// ### End of Step 4 ### 

*Also should check your table's name, mine table naming prefix is evo_XXXX. Change it, if yours are different with mine.

15 May 18, 2008 06:28

Hi Guys,

Maybe I am stupid.. or just missing something.. I read the post about hacking the B2evo to add multi users..Followed all the steps carefuly.. and GRIN..just what I was thinking it didn't work..
I am now trying to figure out the Why no work..
It seems to me that this should not be skin dependant am I wrong???
cuz when I try to logon as a new user I get the same standard logon screen..nothing new..
I will be the first to admit that this PHP runs circles around my brain and as of yet.. I haven't fully grasped it.. maybe never will so I am dependant on peeps like you to help dig me out of the hole I have dug..
IF the addy helps in aiding my frustration its blog.cloisterbooks.com
Any feedback would b great.. cuz if I can;t get the multi-user set up.. this project will get shot down.. or should I just go back to ver 1.9??? I running 2.4
Thanks

I think I found my Mistake Never mind.. Gads I hate being stupid :oops:

16 May 19, 2008 13:53

Airwreck wrote:

Hi Guys,

Maybe I am stupid.. or just missing something.. I read the post about hacking the B2evo to add multi users..Followed all the steps carefuly.. and GRIN..just what I was thinking it didn't work..
I am now trying to figure out the Why no work..
It seems to me that this should not be skin dependant am I wrong???
cuz when I try to logon as a new user I get the same standard logon screen..nothing new..
I will be the first to admit that this PHP runs circles around my brain and as of yet.. I haven't fully grasped it.. maybe never will so I am dependant on peeps like you to help dig me out of the hole I have dug..
IF the addy helps in aiding my frustration its blog.cloisterbooks.com
Any feedback would b great.. cuz if I can;t get the multi-user set up.. this project will get shot down.. or should I just go back to ver 1.9??? I running 2.4
Thanks

I think I found my Mistake Never mind.. Gads I hate being stupid :oops:

What's the error messages on your browser?
Can you show that? :roll:

17 May 20, 2008 04:08

Never gave me an error message..just wasn't working.. Like I said.. hate being stupid.. :-p found the answer in one of the many levels of the blog "set up" pages.
Thanks

18 May 26, 2008 20:05

I made the changes listed to the files, uploaded the autoblog plugin, I get nothing but blank pages...I am also using evo_xxxx as my table prefix...any ideas?

Thanks

19 May 27, 2008 07:15

Celtica,
Where I solved my problem was I did not change a setting to make users validate their email. when I did this.. I got the multi log on feature to show..so the changes I made in the autoblog worked..It was under Global settings.. General.. Not sure if this will help you.. Hope so..

20 May 27, 2008 07:32

celtica wrote:

I made the changes listed to the files, uploaded the autoblog plugin, I get nothing but blank pages...I am also using evo_xxxx as my table prefix...any ideas?

Thanks

umm....how about try that...
on /inc/_core/_template.funcs.php
from line 130 to line 150 find:

 else
// ### Hack for getting a blog when user registers v.2 [Step 4] ###
   {   // This should be a "follow up" redirect
      // Note: Also see http://de3.php.net/manual/en/function.header.php#50588 and the other comments around
      @header( 'HTTP/1.1 303 See Other' );
   }

   @header( 'Location: '.$redirect_to, true, $status ); // explictly setting the status is required for (fast)cgi
   exit();
}


/**
 * Sends HTTP headers to avoid caching of the page.
 */
function header_nocache()
{
   @header('Expires: Tue, 25 Mar 2003 05:00:00 GMT');
   @header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
   @header('Cache-Control: no-cache, must-revalidate');
   @header('Pragma: no-cache');
}
// ### End of Step 4 ###

and back to

   else
   {   // This should be a "follow up" redirect
      // Note: Also see http://de3.php.net/manual/en/function.header.php#50588 and the other comments around
      header( 'HTTP/1.1 303 See Other' );
   }

   header( 'Location: '.$redirect_to, true, $status ); // explictly setting the status is required for (fast)cgi
   exit();
}


/**
 * Sends HTTP headers to avoid caching of the page.
 */
function header_nocache()
{
   header('Expires: Tue, 25 Mar 2003 05:00:00 GMT');
   header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
   header('Cache-Control: no-cache, must-revalidate');
   header('Pragma: no-cache');
}

I think it probably has error message on screen~
Would you show me that?

21 May 27, 2008 18:33

Hi Airwreck & denielchiang,

Thanks for your help! I tried change the validation via email setting off (I had it turned on originally), and I made the changes that denielchiang suggested, I still get a blank page and nothing loads, the page is blank. So I started from scratch and then realized that while I uploaded the AutoBlog plugin I didn't install it. When I went to the Plugins Install section of the Admin I noticed that this page lists NO plugins to install! It has the header row with the names of each column but nothing displays under that. I removed the Autoblog plugin and reloaded the Install Plugin page and the plugins are then listed, reupload the AutoBlog plugin, same thing the page is empty....so I am thinking that this is where the problem is coming from as this is before I even make the changes to the individual files.

22 May 27, 2008 18:39

try :

1) /conf/_advanced.php, uncomment the line for memory limit ( remove the // from the start of the last line )

// If you get blank pages, PHP may be crashing because it doesn't have enough memory.
// The default is 8 MB (in PHP < 5.2) and 128 MB (in PHP > 5.2)
// Try uncommmenting the following line:
ini_set( 'memory_limit', '32M' );

2) if that doesn't work, in the same file uncomment the line for displaying errors ( last line, same thing )

// To help debugging severe errors, you'll probably want PHP to display the errors on screen.
// In this case, uncomment the following line:
ini_set( 'display_errors', 'on' );

¥

23 May 27, 2008 19:00

¥åßßå wrote:

try :

1) /conf/_advanced.php, uncomment the line for memory limit ( remove the // from the start of the last line )

// If you get blank pages, PHP may be crashing because it doesn't have enough memory.
// The default is 8 MB (in PHP < 5.2) and 128 MB (in PHP > 5.2)
// Try uncommmenting the following line:
ini_set( 'memory_limit', '32M' );

2) if that doesn't work, in the same file uncomment the line for displaying errors ( last line, same thing )

// To help debugging severe errors, you'll probably want PHP to display the errors on screen.
// In this case, uncomment the following line:
ini_set( 'display_errors', 'on' );

¥

Thanks for your reply. I did the first part, no change, then I turned on the error reporting and got the following when clicking on Install New Plugin:

"Fatal error: Call to undefined function: skin_list_start() in /usr/local/psa/home/vhosts/fathersdefense.com/httpdocs/plugins/autoblog_plugin/_autoblog.plugin.php on line 696"

All I can say is huh? I am not even sure what this means, somethign to do with the skin? I am using the NiftyCorners skin, but this is a brand new installation so I am not really tied to this skin so I can change it if that is the problem.

24 May 27, 2008 19:05

Don't try to install Autoblog plugin in b2evo 2.x it won't work.

25 May 27, 2008 19:09

I really haven't read any of the hack code, so I can only assume you missed a step or found a bug in it.

¥

26 May 27, 2008 19:13

Bummer. :-(

This is something that would be great to use...would anyone recommend going back to one of the older versions (of B2evo) to run this, or would it now be worth the install (with bugs and such in old version)?

Thanks for your help.

EDIT: for Clarification

27 May 27, 2008 19:18

If you really need this autoblog functionality in your site you can use 1.10.x as it's not that bad and there are no bugs (it just doesn't have cool new features).

After somebody find a time to upgrade the plugin to b2evo 2.x you could switch back to the latest 2.x version

28 May 27, 2008 19:35

Awesome, Thanks Sam2kb!

29 May 27, 2008 19:39

No problem, I hope to finish upgrading this plugin soon ;), but no promises :)

31 Jun 15, 2008 23:10

You sir, are a prince & a gentleman! :-)


Form is loading...