Compguy11 Custom Modifications: ipsclass Help - Compguy11 Custom Modifications

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

ipsclass Help Custom Profile Fields Rate Topic: -----

#1 User is offline   zerogravity Icon

  • Newbie
  • Group: Members
  • Posts: 6
  • Joined: 11-February 07

Posted 08 October 2008 - 06:16 AM

I'd like to be able to use an ipsclass from a custom profile field I made. Like this the following, but obviously for the custom profile field.

$this->ipsclass->vars['blahblah']


Basically I want to be able to insert the info from a custom profile field somewhere in a mod. The mod already has a string $this->ipsclass->vars['irc_name'] that it uses, which used the display name for irc_name.

Basically I wanted to do the same thing, but for a custom profile field. I've been pulling my hair out over this for like the last couple of days. Just feel so brainless.
0

#2 User is offline   compguy11 Icon

  • Head Programmer
  • Group: Management
  • Posts: 1,674
  • Joined: 26-November 04
  • Gender:Male
  • Location:Wherever you need me...

Posted 08 October 2008 - 02:37 PM

Pulling a custom profile field from the database actually takes a lot more steps.. here is a quick guide.

Your first step is to require all this loading stuff:
require_once( ROOT_PATH.'sources/classes/class_custom_fields.php' );
				$this->custom_fields = new custom_fields( $this->ipsclass->DB );
				
				$this->custom_fields->member_id  = $this->ipsclass->member['id'];
				$this->custom_fields->cache_data = $this->ipsclass->cache['profilefields'];
				$this->custom_fields->admin	  = intval($this->ipsclass->member['g_access_cp']);
				$this->custom_fields->supmod	 = intval($this->ipsclass->member['g_is_supmod']);

Now you have an object called $this->custom_fields that will help us get the data we need. Note that for the above to have worked, we needed the 'profilefields' cache loaded, and we need to have certain member data loaded.

Alright.. now the messy part.
				$this->custom_fields->member_data = array();
				$this->custom_fields->mem_data_id = $member['id'];
				$this->custom_fields->member_data = $member;
				$this->custom_fields->admin		= intval($this->ipsclass->member['g_access_cp']);
				$this->custom_fields->supmod	   = intval($this->ipsclass->member['g_is_supmod']);
				$this->custom_fields->member_id	   = $this->ipsclass->member['id'];
				$this->custom_fields->init_data();
				$this->custom_fields->parse_to_view( 1 );

				if ( count( $this->custom_fields->out_fields ) )
				{
					foreach( $this->custom_fields->out_fields as $i => $data )
					{
						if ( $data )
						{
							$member['custom_fields'] .= "\n".$this->custom_fields->method_format_field_for_topic_view( $i );
						}
					}
				}


We are assuming here you have an array called $member that contains all the really important data for the member we are loading the custom profile data for. It needs to at least contain that member's row in ibf_pfields_data (or whatever that table is called). I can't recall exactly how much information it needs, but you can always open class_custom_fields.php and take a look around.

See if that helps any.
compguy11

http://compguy11.com

[ You may PM me if you have any questions or you wish to discuss a custom modification. ]
0

#3 User is offline   zerogravity Icon

  • Newbie
  • Group: Members
  • Posts: 6
  • Joined: 11-February 07

Posted 08 October 2008 - 02:39 PM

Just woke up, now I posted about this on the invisionize forums too. and someone gave me this for an answer. I'm still a little confused as to how I would use that, or where I would put it.

The mod I want to use it for, I think the guy who wrote it is like inactive or something he hasn't posted anything for months. Its for the IBIRC v2.1.1 mod. I don't consider myself an idiot when it comes to php, but when it comes to ipb it seems so darn convoluted I do feel like an idiot.

edit: Realized you posted right before I did comp; umm okay so do hmm where would one go about sticking this stuff >.<

This post has been edited by zerogravity: 08 October 2008 - 03:09 PM

0

#4 User is offline   compguy11 Icon

  • Head Programmer
  • Group: Management
  • Posts: 1,674
  • Joined: 26-November 04
  • Gender:Male
  • Location:Wherever you need me...

Posted 08 October 2008 - 10:33 PM

That depends.. explain in a bit more detail exactly where this custom profile field should be shown.
compguy11

http://compguy11.com

[ You may PM me if you have any questions or you wish to discuss a custom modification. ]
0

#5 User is offline   zerogravity Icon

  • Newbie
  • Group: Members
  • Posts: 6
  • Joined: 11-February 07

Posted 08 October 2008 - 11:54 PM

Well basically this guy did up a component to kinda integrate PJIRC into the forum. A logged in user clicks on live chat, it goes to the page and the auto join the chat using their display name as their IRC nick. All of the specific join and perform commands are done in a skin bit that looks something like this.

<param name="nick" value="{$this->ipsclass->vars['irc_name']}" />
<param name="alternatenick" value="{$this->ipsclass->vars['irc_name']}???" />
<param name="name" value="Java User" />
<param name="host" value="{$this->ipsclass->vars['ibirc_server']}" />
<param name="gui" value="pixx" />
<param name="quitmessage" value="{$this->ipsclass->vars['ibirc_quit']}" />
<param name="asl" value="true" />
<param name="command1" value="/join {$this->ipsclass->vars['ibirc_channel']}" />
<param name="command2" value="/nick TFS|{$this->ipsclass->vars['irc_name']}"



The class things for irc_name I believe were somehow set in a file mod_javairc.php


As you've probably figured out by now, I'm not quite sure how that stuff really works and I spent almost a full 15 hours a couple of days ago trying to figure it out on my own. And then another few hours each day after until last night when I gave up and asked for help.

This post has been edited by zerogravity: 08 October 2008 - 11:54 PM

0

#6 User is offline   compguy11 Icon

  • Head Programmer
  • Group: Management
  • Posts: 1,674
  • Joined: 26-November 04
  • Gender:Male
  • Location:Wherever you need me...

Posted 09 October 2008 - 02:15 AM

So in that file, somewhere (I didn't look at the file), you need to place that code the person from Invisionize gave you. You will end up with an array of names and data values for the custom profile fields. Call up the name of the field you want, plug it into those parameter tags, and you should be good.

Let me know if you have more specific questions.
compguy11

http://compguy11.com

[ You may PM me if you have any questions or you wish to discuss a custom modification. ]
0

#7 User is offline   zerogravity Icon

  • Newbie
  • Group: Members
  • Posts: 6
  • Joined: 11-February 07

Posted 09 October 2008 - 02:23 AM

based on whats already in that file will I need the

require_once( ROOT_PATH.'sources/classes/class_custom_fields.php' );
				$this->custom_fields = new custom_fields( $this->ipsclass->DB );


part?
0

#8 User is offline   compguy11 Icon

  • Head Programmer
  • Group: Management
  • Posts: 1,674
  • Joined: 26-November 04
  • Gender:Male
  • Location:Wherever you need me...

Posted 09 October 2008 - 12:11 PM

Yes. I don't see it already in the file.
compguy11

http://compguy11.com

[ You may PM me if you have any questions or you wish to discuss a custom modification. ]
0

#9 User is offline   zerogravity Icon

  • Newbie
  • Group: Members
  • Posts: 6
  • Joined: 11-February 07

Posted 09 October 2008 - 04:14 PM

Okay, and I should use what the guy on the invisionize thread gave me and not your example? Is there a difference in the two. Because I'm kind of hell bent on kind of understanding how it works so I do this right. Also in the mod_javairc.php file there is a class and function bit, is it going to screw things up if I put that bit of code in the wrong spot?

Should I put it under function? or make a new function? Do I need to create a new class, and then on top of that should it be done somewhere else that isn't this mod so that this could be used in other mod or other stuff later down the line maybe.

This post has been edited by zerogravity: 09 October 2008 - 04:32 PM

0

#10 User is offline   compguy11 Icon

  • Head Programmer
  • Group: Management
  • Posts: 1,674
  • Joined: 26-November 04
  • Gender:Male
  • Location:Wherever you need me...

Posted 10 October 2008 - 12:05 PM

You are only allowed to have one class, and you can never execute code directly in a class... you have to put it inside a function. Which function you put it in is up to you and how "clean" you want your code. (I would recommend a new function and then you pass data along to it and have the function return the data you want--- seems cleaner to me)

Anyway, I suggested his code only because it was more condensed and cleaner... our code essentially does the same thing... his is just more likely to work in any environment with modification... mine might take some modification...

(FYI: This is PHP... you can't go wrong or screw things up... place it where you think, and if you are wrong, you will get an error message and you will figure it out from there. Most programmers learn from trial and error, so don't think you are alone in this process at all)
compguy11

http://compguy11.com

[ You may PM me if you have any questions or you wish to discuss a custom modification. ]
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users