SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Hybrid View

  1. #1
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Popup like sitepoint on new PM

    Hello Guys,

    Would you like me to guide how do I raise a JS Popup like we are shown when we receive a new PM with the option of opening it in a new window as well as the same ole' window.

    TIA.


    -Omair
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Omair. Are you asking how to code this feature? It really is a client side scripting issue (javascript). Would you like me to move the thread into that forum?

  3. #3
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sure..


    -Omair
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  4. #4
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone???
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  5. #5
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,810
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Think it's both Sid...

    You will need to have a table for messages, with a field for "read" (along with recipient user id, sender user id, message etc).

    On insert, the "read" field should default to "no" (either by enmum or value).

    You then need a script (prolly in some sort of included config file) that will check the user id of the user (prolly from cookie or session), then check if that table has any messages in it with that user as the recipient and the "read" option set to default.

    If it does, you need to return the message id to some funky js (this bit needs to be there!), and have the "read" button direct to a display page (www.mysite.com/message?ID=xxxx).

    You will also need to ensure that on loading that page (by the correct user obviously - you're gonna need verification), the record is updated to a "read" value.

    Simple enough -I'm sure

    H
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS

  6. #6
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello H,

    Well, I know the Database stuff, the only thing I need to know is the JS Part.


    -Omair
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  7. #7
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    onLoad="if(confirm('You have [x: generate number dynamically] new message[s: if greater than 1 write "s"]. Would you like to read them now?')){window.location.href='pm.php';}"
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  8. #8
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    Actually, Jeremy I need the code to be in PHP. I mean the code should look like:

    PHP Code:
    echo ("<script language=\"Java Scipt\">"); 
    Also, I remember I have asked this question once before but I can't find that thread. Either freakysid or freddydoesphp answered that thread. Maybe they can answer this one again.


    Salam,
    -Omair
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  9. #9
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok. I have contacted freakysid personally and he told me that he was probably not the one who helped me out before. So I am sure that freddydoesphp was the one who helped me out before. So freddy are you there ?


    -Omair
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  10. #10
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sincec its Christmas Eve and I have things to still take care of, I have created the basic script for you. I wiwll leave it up to you to implement it, (change filenames, varaible names and syntax, etc....) Also you will need to run the queries and assign the pm id to the correct varaible, but this does work, if you do it properly.

    PHP Code:

    <?
    //Query the PM table and check for new ones
    //If there is a new one, assign the id of it to $newpm
    $newpm '234';

    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
        <title>Untitled</title>

    <script language="JavaScript1.2" type="text/javascript">
    <!--
        function pmConfirm() {
            var step1 = false;
            var step2 = false;
            if(confirm("You have a new Private Message\nWould you like to view it?")) {
                step1 = true;
                }
            else {
                return false;
                }
            if(step1) {
                if(confirm("Would you like to view it in a new window?\n(click cancel to view it the same window)")) {
                    step2 = true;
                    window.open("pm.php?pmid=<?=$newpm?>", "pmWindow", "toolbar=yes,scrollbars=yes,resizable=yes,width=600,height=400");
                    }
                else {
                    window.location.href = "pm.php?pmid=<?=$newpm?>";
                    }
                }
            else {
                return false;
                }        
            }
    <?
    if($newpm) {
        print 
    "window.onLoad = pmConfirm(); ";
        }

    ?>
    //-->
    </script>


    </head>

    <body>



    </body>
    </html>
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  11. #11
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a zillions.. I would check it out and would let ya know.



    Salam,
    -Omair
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •