[ABD] Collapsible Categories

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
Earalia
Registered User
Posts: 8
Joined: Fri Jan 18, 2008 6:18 pm

Re: [Beta] Collapsible Categories

Post by Earalia »

i think i have the soluce

***_profile_fields_data is empty for the user
in the ajax_update_collapse.php there's an update order, but if it didn't found what to update, it did nothing

i think in this case, it must do an insert

if you trap the not-found error, i think the problem is resolved ;)
(sorry for my english :oops: )
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53636
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: [Beta] Collapsible Categories

Post by Brf »

Nono.... The field is always there. It is just null.
I believe the problem is in having the forum-array starting with a null cell. When it tries to implode it into a string, there is an error.
Earalia
Registered User
Posts: 8
Joined: Fri Jan 18, 2008 6:18 pm

Re: [Beta] Collapsible Categories

Post by Earalia »

Hum...
with a lot of test, i'm sure problem due to or linked to the ***_profile_fields_data table.

* create an account : user unkown in this table, it doesn't work
* create an account : user in the table with tests settings and a default value : it works
* existing account : user unkown in this table, it doesn't work
* modifying accoung, with tests setting : user inserted in the table, it works

if there's others "personnal profile values", it probably always works

i hope it will help you to know why your field is null
Last edited by Earalia on Sat Jan 19, 2008 12:06 am, edited 3 times in total.
User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: [Beta] Collapsible Categories

Post by EXreaction »

Instead of storing it in the database, why not just use a cookie?
xxxopenxxx
Registered User
Posts: 34
Joined: Thu Jan 10, 2008 11:07 pm

Re: [Beta] Collapsible Categories

Post by xxxopenxxx »

Mine also works perfectly once I put "null" for the default value. Thanks a ton!
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53636
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: [Beta] Collapsible Categories

Post by Brf »

EXreaction wrote:Instead of storing it in the database, why not just use a cookie?
Cookies do not work if you log in from more than one computer ;)
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53636
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: [Beta] Collapsible Categories

Post by Brf »

Earalia wrote:i hope it will help you to know why your field is null
As I said.

Go into the definition for the profile field and put 0 (zero) into the default value.
User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: [Beta] Collapsible Categories

Post by EXreaction »

Brf wrote:
EXreaction wrote:Instead of storing it in the database, why not just use a cookie?
Cookies do not work if you log in from more than one computer ;)
Cookies = less load on the server & allows guests to use it.

Besides, it would take a whole few seconds to minimize what the user wants.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53636
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: [Beta] Collapsible Categories

Post by Brf »

Well, I didnt want to mess with cookies.
The code for the custom profile fields is already in place so I just used that.
With a custom profile field, I can also troubleshoot or clear the field easily as an administrator, since that field shows in user profiles.

As for cookies, I am not familiar with writing a cookie after the HTTP headers have been sent, so I would not know how to do it without invoking an ajax page as I am already doing. If I need to invoke an ajax page, then I am not gaining much as far as server load.
elazard
Registered User
Posts: 73
Joined: Sat Jan 19, 2008 5:00 pm

Re: [Beta] Collapsible Categories

Post by elazard »

Hello ive installed the mod which works really well for admin but not for users! i mean i used 0 as default for the textarea used right name and stuff but it still does not remember the collapsed categories for user. do you have an idea?

i tried making the textarea visible for edit in profil and it keeps beeing on 0 if i collapse a category (for user i mean not for admins)

sorry for my bad english im belgian :p

edit : well indeed it works if do one setting myself when the field is visible in profile (i mean if i go to my profile and set the field to f.e. 3, it works and keep working but the first setting cant be done automatically! : /)

one more edit : it seems that the mod does not aumatically write in the db i mean i ve got four test users and only 3 are in the profile_fields_data table. (those three are the one for which i made settings myself)
user_id pf_fcol
2 [BLOB - 2 o]
53 [BLOB - 0 o]
54 [BLOB - 0 o]

you see i dont see the fourth user : /

well i guess it shoukd write in that table at registration should it? dunno plz help :)


So my solution is : there should be a if/else somewhere that insert into profile_fields_data table 0 if there is no value for the user (but i dont know how to :p)


ok fixed it :

Code: Select all

function get_user_collapse()
{
	global $user;
	if (!($user->data['is_registered']))
	{
		return(array());
	}
	else
	{
		$user->get_profile_fields($user->data['user_id']);
		$collapse_list=$user->profile_fields['pf_fcol'];
		if(!isset ($collapse_list))
		{
		$user_id=$user->data['user_id'];
		mysql_query("INSERT INTO profile_fields_data VALUES('$user_id', '0')");

		}
		$collapse_array=explode(',',$collapse_list);
		if (is_array($collapse_array))
		{
			return($collapse_array);
		}
		else
		{
			return(array());
		}
	}
}
if someone could translate my query into a good phpbb query it would be great :)

here is the query that be translated
if(!isset ($collapse_list))
{
$user_id=$user->data['user_id'];
mysql_query("INSERT INTO profile_fields_data VALUES('$user_id', '0')");

}
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53636
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: [Beta] Collapsible Categories

Post by Brf »

Ah-ha.
I see where Earalia was driving at now too... It may be possible that there is no record in the Profile_fields table for a particular user. I have another profile field, so I never encountered that problem before....

I will need to take that into account when I do the update.
xxxopenxxx
Registered User
Posts: 34
Joined: Thu Jan 10, 2008 11:07 pm

Re: [Beta] Collapsible Categories

Post by xxxopenxxx »

Brf wrote:It is probably having a problem with the null field.
I changed the Install to specify a default value of 0 (zero) so that field will never be null.
It's strange because even if I globally set the default value to "null" or "0" it doesn't work unless I go into the ACP and go to profile and I can put ANYTHING 0, null, 2, 4, XyZ. Then when I save it, the user is able to collapse and save data, but not before then.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53636
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: [Beta] Collapsible Categories

Post by Brf »

Yes. That is what we were talking about.
Apparently, the table row does not get stored until you pull it up in the UCP or ACP.
I am replacing the update with

Code: Select all

	$sql = 'UPDATE ' . PROFILE_FIELDS_DATA_TABLE . "
					SET pf_fcol = '" . $collapse_string . "'
					WHERE user_id = " . $user->data['user_id'];
	$db->sql_query($sql);
	if (!$db->sql_affectedrows())
	{
		$sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . 
				" (user_id,pf_fcol) values ({$user->data['user_id']} , '{$collapse_string}')" ;
		$db->sql_query($sql);
	}	
elazard
Registered User
Posts: 73
Joined: Sat Jan 19, 2008 5:00 pm

Re: [Beta] Collapsible Categories

Post by elazard »

obvioulsy i'm like the jesus of collapsible categories xD (ty for the correction :))
Earalia
Registered User
Posts: 8
Joined: Fri Jan 18, 2008 6:18 pm

Re: [Beta] Collapsible Categories

Post by Earalia »

Brf wrote:Ah-ha.
I see where Earalia was driving at now too...
happy to served :)

it works good with the insert :)

thanks for your work !

Return to “[3.0.x] Abandoned MODs”