Results 1 to 6 of 6

Thread: Hide links & emails question in forum

  1. #1
    Join Date
    Dec 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Hide links & emails question in forum

    Wow - I've been using DD for 2 years and never thought to click on the forum link

    Hi folks - first post, and yes, I tried searching for this but couldn't find anything that looked correct.

    I have a fairly simple forum system running as part of my site as part of the member system memberkit. I would like the forum to be public - members can post to the forum, and the public can post to the forum by putting in a name and email address.....

    but....I would like some simple code to either block out, xxxx out, or remove entirely email address and phone numbers from forum visitors that are not members.

    Now as part fo the system, I do have IFEQ tags available to determine if the user is a member or not, so I've got somethnig to execute the code on, but I just don't know what the code needs to be.

    I've seen this done on other forums before for links and such, I'm just not sure how to do it. I'm guessing it would need to read the whole post message and look for certain strings of characters, etc.

    the skeleton of the forum is here - http://www.enrollerconnect.com/forum/index.php to give you an idea of the start new thread capabilities.

    Basically, I want to prevent users from posting job's with contact information available to non-members. Any ideas?

    Thanks in advance.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Every time that the forum would generate a phone number or email, you need to surround that in a conditional statement:
    if (member) { display email; }
    else { display '------'; }

    That's pseudo code since I have no idea what language you're using. PHP?
    if (isset($loggedin)) { echo $email; }
    else { echo '------'; }

    Adapt as needed.

    There's no way to "generalize" this that I can think of: you'll just need to modify every time that an email or phone number could be displayed.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Dec 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Daniel

    I'm not trying to hide system generated email or phone numbers, rather those that a user would enter into the WYSWIG editor (such as the one on here) so I can't do it with conditionals.

    It would basically be like me entering my email address right here, and having the DD forum system blanking it out if someone else was reading the post and was not logged in.

    Now, what I meant with the member IFEQ stuff is that I know when a user is logged in or not, so I could do a
    IFEQ:not logged in -> execute javascript -> ifeq:end

    I guess what the script needs to do is (if run) read the entire title and body of the post, and look for any string matching (xxx)xxx-xxxx (and the other versions of phone numbers) and anything xxx@xxx.com to find the email address, and replace them with something else. I just don't know enough about script language to write this.

    The backend is in PHP BTW

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Ah. That's a very different issue.

    You still need some sort of conditional (I think), but I'll get to that later.


    What you need is regex pattern matching: look into the preg_match() and other similar PHP functions. Basically what you want to do is see if a pattern that looks like an email or looks like a phone number exists in the post.
    If so, block it out (or you could tell the user they need to reformat).

    But this may be problematic: users tend to be smart about getting around spam filters and the like, so they'll start typing name (AT) email DOT com, rather than their explicit email. Same for the phone number. Additionally, you may find (rarely, if your regex is accurate enough) some false positives.
    The main problem will be users trying to get around this, and I have to say that in most cases I agree with them: it's annoying being censored. You should clearly explain why this is the case and maybe your users will respect it.


    Finally, if you wish to display these to members and hide them from nonmembers, you'll need to either store two versions of each post or run a conditional replacement (based on whether they are registered or not) every time you display a post. The second version would be a little easier to program but the first would be a little more efficient on the server if you get a lot of hits every day. Unless your site is particularly busy, the second one is probably fine.


    Or you could just not show anyone these things (or as I said just restrict the user from posting them) and have another means (profiles for example) to view the contact details.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Dec 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post

    What you need is regex pattern matching: look into the preg_match() and other similar PHP functions. Basically what you want to do is see if a pattern that looks like an email or looks like a phone number exists in the post.
    If so, block it out (or you could tell the user they need to reformat).
    yep, and I'll be most of them would fall for it, that's the sad part.


    But this may be problematic: users tend to be smart about getting around spam filters and the like, so they'll start typing name (AT) email DOT com, rather than their explicit email. Same for the phone number. Additionally, you may find (rarely, if your regex is accurate enough) some false positives.
    The main problem will be users trying to get around this, and I have to say that in most cases I agree with them: it's annoying being censored. You should clearly explain why this is the case and maybe your users will respect it.
    Maybe 1 in 1000 people that would hit my site have enough of a clue to post around the script this way, and again, this is why I'm still thinking about the javascript as an option since I'm not sure any of them would figure out how to get around it anyway.

    Finally, if you wish to display these to members and hide them from nonmembers, you'll need to either store two versions of each post or run a conditional replacement (based on whether they are registered or not) every time you display a post. The second version would be a little easier to program but the first would be a little more efficient on the server if you get a lot of hits every day. Unless your site is particularly busy, the second one is probably fine.
    And the javascript option is looking better and better - at least I know the java can block 75% of what I want it to, and I can monitor the rest of the posts by hand and with a very detailed forum rules (wait, does anyone actually read those?) the way the site is setup, I can run a call to the javascript in the background if the user isn't logged in.

    Or you could just not show anyone these things (or as I said just restrict the user from posting them) and have another means (profiles for example) to view the contact details.
    I've got a full profile, calendar and messaging system, but it's part of the paid section of the site. I can hide the forum altogethor from the public but would like it to drive some traffic.

    And I thought this was going to be easy....

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    This is hard because it's dealing with user input and trying to predict what it might be like, and not just what it might be like, but then every permutation of what it might be like. User input is often the most complex aspect of programming. If there's a way to avoid it (politely ask your users not to post info, ban anyone who does [is this too harsh?], or have active moderators patrolling all new posts....), then that's going to be much easier for you.

    You could do a complex setup like this:
    When a user posts a message, it is visible but only to members. It is filtered from the public, though. Then when the moderator (you?) gets a chance to approve messages, they become visible to the public as well.

    So basically it would be like what happens to "live" shows on TV: they add in a 5 second delay in case they need to censor any 'bad words' or other unexpected events.

    In your case, though, it would entirely depend on the moderators, so it might be 24 hours or more before the new posts get through.

    Depending on the way your forum works, this might be reasonable. But it might also cause confusion (if a member stops by the forum for a minute and doesn't have time to log in, then sees no new posts, and returns later to find that there were actually new posts.....).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •