MyBB Community Forums

Full Version: I need help with the Custom Profile Fields
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi everybody, I'm a new beginner , I 'm trying to write a plugin , and I need help with some question :
1. How to take the Custom Profile Field's ID automatcally in the plugin ?
2. How to drop the Custom Profile Field's ID when i uninstall?
I hope that my question is not too hard Big Grin .
Can somebody help me,please?
1. How to take the Custom Profile Field's ID automatcally in the plugin ?

You mean: How to *make* the Custom Profile Field's ID automatically in the plugin ?


// I'm not sure, but now maybe others will understand better
I mean like when i write a plugin , I use the Custom Profile Field system , like the Flag country , mybb twitter , or favorite drink ... , and now I need to know that how to take the field's ID automatically to put it into the plugin , because each field of each forum are difference , so it will be better to automatically out the ID into the plugin... Can you understand me ???
If you mean get the ID of the custom profile field you just created with your plugin?

You can do:

$new_data = $db->insert_query("profilefields"...

And $new_data will be the ID number of the row you just created.
ok , so I have this
	if($post[$source] != '' && $source) 
	{
		$post['Blast'] = "<tr>

    <td colspan=\"4\">
    <table>
      <tr>
        <td width=\"53\"></td>
        <td width=\"30\"><img src=\"images/blast/blast_first.png\" width=\"30\" height=\"56\"></td>
        <td class=\"blast\" width=\"670\" height=\"56\"><div align=\"center\">{$post['fidx']}</div></td>
      </tr>
    </table>

    </td>
  </tr></if>";

I will do like this ?

	if($post[$source] != '' && $source) 
	{
		$post['Blast'] = "<tr>

    <td colspan=\"4\">
    <table>
      <tr>
        <td width=\"53\"></td>
        <td width=\"30\"><img src=\"images/blast/blast_first.png\" width=\"30\" height=\"56\"></td>
        <td class=\"blast\" width=\"670\" height=\"56\"><div align=\"center\">$new_data = $db->insert_query("profilefields"... </div></td>
      </tr>
    </table>

    </td>
  </tr></if>";

????
    if($post[$source] != '' && $source) 
    {
        $new_data = $db->insert_query("profilefields"... 
        $post['Blast'] = "<tr>

    <td colspan=\"4\">
    <table>
      <tr>
        <td width=\"53\"></td>
        <td width=\"30\"><img src=\"images/blast/blast_first.png\" width=\"30\" height=\"56\"></td>
        <td class=\"blast\" width=\"670\" height=\"56\"><div align=\"center\">".$new_data."</div></td>
      </tr>
    </table>

    </td>
  </tr></if>"; 

I would do it like that...
haha, now i got my problem Big Grin
function parse_Blast($post)
{	
	global $db, $mybb, $source;
	
	if(!$source)
	{
		if($mybb->settings['Blastfield'] == '' || !$mybb->settings['Blastfield']) 
		{
			$query = $db->simple_select("profilefields", "fid", "name='Blast'", array('limit' => 1));
			$source = "fid".$db->fetch_field($query, "fid");
		} 
		else 
		{
			$source = "fid".$mybb->settings['Blastfield'];
		}
	}
		
	if($post[$source] != '' && $source) 
	{
		$post['Blast'] = "<if condition=\"{$post[$source]}\"><tr>

    <td colspan=\"4\">
    <table>
      <tr>
        <td width=\"53\"></td>
        <td width=\"30\"><img src=\"images/Blast/Blast_first.png\" width=\"30\" height=\"56\"></td>
        <td class=\"Blast\" width=\"670\" height=\"56\"><div align=\"center\">{$post[$source]}</div></td>
      </tr>
    </table>

    </td>
  </tr></if>";
		
}
}
?>
And now i just need to know how to drop the Field's ID from the database when I uninstall it Big Grin
Thanks for all yours help Big Grin
anyone ???
omg , my question is too hard ???
Pages: 1 2