How to add default public room?

Help
Daenarys
2013-07-29
2013-07-30
  • Daenarys
    Daenarys
    2013-07-29

    Hello,
    I would like to create many others defaults public rooms, I did a google search and I came across this faq. But I can not find the line (//$DefaultChatRooms = array(ROOM1, ROOM2, ROOM3, ROOM4, ROOM5);) in config.lib.php. So I'd like to know how to do, thank you.

     
  • Hi Daenarys,
    That faq answer is a little obsolete, as it was available for earlier versions of plus, when the Configuration tab in admin panel was not implemented yet. Thank you for bringit up, I'll adjust that answer soon.

    Now the config looks different, so the area you wanna play with is this:
    // Proposed (default) rooms and reserved names for private rooms
    define("ROOM1", $ROOM1);
    define("ROOM2", $ROOM2);
    define("ROOM3", $ROOM3);
    define("ROOM4", $ROOM4);
    define("ROOM5", $ROOM5);
    define("ROOM6", $ROOM6);
    define("ROOM7", $ROOM7);
    define("ROOM8", $ROOM8);
    define("ROOM9", $ROOM9);

    $PUBLIC_ROOMS = $EN_ROOM1 ? ($RES_ROOM1 ? ROOM1." [R], " : ROOM1.", ") : "";
    $PUBLIC_ROOMS .= $EN_ROOM2 ? ($RES_ROOM2 ? ROOM2." [R], " : ROOM2.", ") : "";
    $PUBLIC_ROOMS .= $EN_ROOM3 ? ($RES_ROOM3 ? ROOM3." [R], " : ROOM3.", ") : "";
    $PUBLIC_ROOMS .= $EN_ROOM4 ? ($RES_ROOM4 ? ROOM4." [R], " : ROOM4.", ") : "";
    $PUBLIC_ROOMS .= $EN_ROOM5 ? ($RES_ROOM5 ? ROOM5." [R], " : ROOM5.", ") : "";
    $PUBLIC_DISP_ROOMS = trim($PUBLIC_ROOMS,", ");
    $PUBLIC_ROOMS = trim(str_replace(" [R]","",$PUBLIC_ROOMS),", ");
    $PRIVATE_ROOMS = $EN_ROOM6 ? ROOM6.", " : "";
    $PRIVATE_ROOMS .= $EN_ROOM7 ? ROOM7.", " : "";
    $PRIVATE_ROOMS .= $EN_ROOM8 ? ROOM8.", " : "";
    $PRIVATE_ROOMS .= $EN_ROOM9 ? ROOM9.", " : "";
    $PRIVATE_ROOMS = trim($PRIVATE_ROOMS,", ");
    $DefaultChatRooms = explode(", ", $PUBLIC_ROOMS);
    if ($PUBLIC_DISP_ROOMS != $PUBLIC_ROOMS) $DefaultDispChatRooms = explode(", ", $PUBLIC_DISP_ROOMS);
    if ($PRIVATE_ROOMS == "") $DefaultPrivateRooms = NULL;
    else $DefaultPrivateRooms = explode(", ", $PRIVATE_ROOMS);

    As you can see, first 5 are public, last 4 are private.
    As a fisrt step, if you don't use the default private rooms, you can make them all public like this:

    $PUBLIC_ROOMS = $EN_ROOM1 ? ($RES_ROOM1 ? ROOM1." [R], " : ROOM1.", ") : "";
    $PUBLIC_ROOMS .= $EN_ROOM2 ? ($RES_ROOM2 ? ROOM2." [R], " : ROOM2.", ") : "";
    $PUBLIC_ROOMS .= $EN_ROOM3 ? ($RES_ROOM3 ? ROOM3." [R], " : ROOM3.", ") : "";
    $PUBLIC_ROOMS .= $EN_ROOM4 ? ($RES_ROOM4 ? ROOM4." [R], " : ROOM4.", ") : "";
    $PUBLIC_ROOMS .= $EN_ROOM5 ? ($RES_ROOM5 ? ROOM5." [R], " : ROOM5.", ") : "";
    $PUBLIC_ROOMS .= $EN_ROOM6 ? ($RES_ROOM6 ? ROOM6." [R], " : ROOM6.", ") : "";
    $PUBLIC_ROOMS .= $EN_ROOM7 ? ($RES_ROOM7 ? ROOM7." [R], " : ROOM7.", ") : "";
    $PUBLIC_ROOMS .= $EN_ROOM8 ? ($RES_ROOM8 ? ROOM8." [R], " : ROOM8.", ") : "";
    $PUBLIC_ROOMS .= $EN_ROOM9 ? ($RES_ROOM9 ? ROOM9." [R], " : ROOM9.", ") : "";
    $PUBLIC_DISP_ROOMS = trim($PUBLIC_ROOMS,", ");
    $PUBLIC_ROOMS = trim(str_replace(" [R]","",$PUBLIC_ROOMS),", ");
    $PRIVATE_ROOMS = "";
    $PRIVATE_ROOMS = trim($PRIVATE_ROOMS,", ");
    

    This will not require you to make the according changes in the database and admin5.php (config sheet)

    If you need more public rooms, it's a bit more complicated:
    1. add as many public rooms you wish in the config.lib.php, using the template above;
    Note: don't forget to add: define("ROOMxx", $ROOMxx);
    2. go to phpmyadmin/chatdb/c_config table and add 3 new fields for each new room created:
    ROOMxx + EN_ROOMxx + RES_ROOMxx
    3. open admin/admin5.php, find the according section and add the needed extra rooms using the template in that file (as for room1 to room5).

    If you need more assistance, please let me know.

     
    Last edit: Ciprian Murariu 2013-07-29
  • Daenarys
    Daenarys
    2013-07-30

    Thank you for your quick answer. I'll do that.