Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-16-2005, 01:43 AM
evenmonkeys's Avatar
evenmonkeys evenmonkeys is offline
 
Join Date: Aug 2004
Location: Iowa
Posts: 896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Create Custom Phrase Types

I'd like to be able to add my own phrase groups... Could someone please come up with something that would make this possible? Adding it in manually via phpMyAdmin doesn't work. Gives errors in the admincp.

Please & thank you.
Reply With Quote
  #2  
Old 07-16-2005, 01:49 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It does work, if you are executing the correct queries

Take a look at add_phrase_type() in includes/adminfunctions_language.php.

Unfortunetely there is no GUI to add Phrase Types. There was a Hack for vB 3.0.X to do so, but AFAIK it has not been ported yet.
Reply With Quote
  #3  
Old 07-16-2005, 01:52 AM
evenmonkeys's Avatar
evenmonkeys evenmonkeys is offline
 
Join Date: Aug 2004
Location: Iowa
Posts: 896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I mean just entering it in directly to the rows. Not through queries or anything. I just inserted a new row. Didn't work. I also tried changing one of the rows that said reserved. Didn't work. >_<;
Reply With Quote
  #4  
Old 07-16-2005, 01:54 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As said, you must use the apropriate Queries.
Take a look at the function I mentioned.
Reply With Quote
  #5  
Old 07-16-2005, 01:59 AM
evenmonkeys's Avatar
evenmonkeys evenmonkeys is offline
 
Join Date: Aug 2004
Location: Iowa
Posts: 896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I don't know what any of that means... so that means someone needs to make something for me to use. =D
Reply With Quote
  #6  
Old 07-16-2005, 02:01 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is most likely not gonna happen (too soon)
So if you want custom Phrase Types, you'll have to look at the code.
Reply With Quote
  #7  
Old 07-16-2005, 02:51 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

newfilename.php
PHP Code:
<?php

require_once("./global.php");

// #############################################################################
// function to allow modifications to add a phrasetype easily
function add_phrase_type($phrasegroup_name$phrasegroup_title)
{
    global 
$DB_site;

    
// first lets check if it exists
    
if ($check $DB_site->query_first("SELECT * FROM " TABLE_PREFIX "phrasetype WHERE fieldname = '$phrasegroup_name'"))
    {
        return 
false;
    }
    else
    { 
// check max id
        
$max_rows $DB_site->query_first("SELECT MAX(phrasetypeid) + 1 AS max FROM " TABLE_PREFIX "phrasetype WHERE phrasetypeid < 1000");
        
$phrasetypeid $max_rows['max'];
        if (
$phrasetypeid)
        {
            
$DB_site->query("INSERT INTO " TABLE_PREFIX "phrasetype (phrasetypeid, fieldname, title, editrows) VALUES ($phrasetypeid, '" addslashes($phrasegroup_name) . "', '" addslashes($phrasegroup_title) . "', 3)");
            
$DB_site->query("ALTER TABLE " TABLE_PREFIX "language ADD phrasegroup_" addslashes($phrasegroup_name) . " MEDIUMTEXT NOT NULL");
            return 
$phrasetypeid;
        }
    }
    return 
false;
}

if (
$_REQUEST['name'] AND $_REQUEST['title'])
{
    
add_phrase_type($_REQUEST['name'], $_REQUEST['title');
}
?>
Run newfilename.php?name=(NEWPHRASENAME)&title=(NEWPHR ASETITLE)
Reply With Quote
  #8  
Old 07-16-2005, 05:53 PM
evenmonkeys's Avatar
evenmonkeys evenmonkeys is offline
 
Join Date: Aug 2004
Location: Iowa
Posts: 896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's not working...

Fatal error: Call to a member function on a non-object in /home/???/domains/???/public_html/pp/admincp/create_new_phrase.php on line 12
Reply With Quote
  #9  
Old 07-16-2005, 07:36 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry I had a typo on the add_phrase_type line near the end
PHP Code:
add_phrase_type($_REQUEST['name'], $_REQUEST['title'); 
should be
PHP Code:
add_phrase_type($_REQUEST['name'], $_REQUEST['title']); 
But that wasn't the cause of your error message, you can't run it from the ACP. If you want security (beside just deleting it after) you can add
PHP Code:
if (!is_member_of($bbuserinfo6))
{
    
print_no_permission();

after
PHP Code:
require ("./global.php"); 
Reply With Quote
  #10  
Old 07-16-2005, 07:41 PM
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Location: Georgia, USA
Posts: 2,519
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, the cause of the error is that your code is for 3.0.x, not 3.5.0.

Here's your code changed for 3.5.0:

PHP Code:
<?php

require_once("./global.php");

if (!
is_member_of($vbulletin->userinfo6))
{
    
print_no_permission();


// #############################################################################
// function to allow modifications to add a phrasetype easily
function add_phrase_type($phrasegroup_name$phrasegroup_title)
{
    global 
$db;

    
// first lets check if it exists
    
if ($check $db->query_first("SELECT * FROM " TABLE_PREFIX "phrasetype WHERE fieldname = '$phrasegroup_name'"))
    {
        return 
false;
    }
    else
    { 
// check max id
        
$max_rows $db->query_first("SELECT MAX(phrasetypeid) + 1 AS max FROM " TABLE_PREFIX "phrasetype WHERE phrasetypeid < 1000");
        
$phrasetypeid $max_rows['max'];
        if (
$phrasetypeid)
        {
            
$db->query_write("INSERT INTO " TABLE_PREFIX "phrasetype (phrasetypeid, fieldname, title, editrows) VALUES ($phrasetypeid, '" $db->escape_string($phrasegroup_name) . "', '" $db->escape_string($phrasegroup_title) . "', 3)");
            
$db->query_write("ALTER TABLE " TABLE_PREFIX "language ADD phrasegroup_" addslashes($phrasegroup_name) . " MEDIUMTEXT NOT NULL");
            return 
$phrasetypeid;
        }
    }
    return 
false;
}

if (
$_REQUEST['name'] AND $_REQUEST['title'])
{
    
add_phrase_type($_REQUEST['name'], $_REQUEST['title']);
}

?>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:50 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04563 seconds
  • Memory Usage 2,288KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete