Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8297629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:29:01+00:00 2026-06-08T15:29:01+00:00

With the screenshot and the code below I am trying to get the ‘Delete

  • 0

With the screenshot and the code below I am trying to get the ‘Delete Button’ to only show to the owner of the wall post. I am logged in as Michael Grigsby and as you can tell from the screenshot that the first wall post is hiding the ‘Delete Button’ but the rest are showing even when it comes to the Mike Wyatt post which I should not have ownership of.

I cannot figure out why this is being caused. I have two possibilities; either I have to loop through the wall posts in jQuery, or my SQL statement is not written right. Any ideas as to why this is acting this way?

enter image description here

PHP and jQuery Code:

<?php   $this->load->helper('date');
        $userid = $this->session->userdata('userid');
        $query  = $this->db->query("SELECT * FROM churchMembers WHERE cMuserId = '{$userid}'");
        $row = $query->row();
        if ($query->num_rows() != 0) {
        $membersChurchId = $row->cMchurchId;
        $query2 = $this->db->query("SELECT wp.idwallPosts, wp.entryData, wp.entryCreationDateTime, u.firstname, u.lastname, u.userid, u.defaultImgURI FROM users u
                                   INNER JOIN wallPosts wp ON wp.postingUserid = u.userid
                                   WHERE wp.wpChurchId = '{$membersChurchId}' ORDER BY wp.idwallPosts DESC LIMIT 200");
foreach ($query2->result() as $row) { ?>
    <?php // the following php is the bootstrapper for the wall
        if ($userid != $row->userid) { ?>
            <script type="text/javascript">
                $(document).ready(function() {
                    $("#delPost").remove();
                });
            </script>
<?php } ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:29:03+00:00Added an answer on June 8, 2026 at 3:29 pm

    I’m looking at this:

    $("#delPost").remove();
    

    …and thinking that you probably have id="delPost" on every item. A common misunderstanding about id attributes is that you can re-use them, but you can’t. There can only be one element per page with id="delPost" (validating your HTML would reveal the error).

    Anyways, your script is only reading the first one, as demonstrated by this demo. Each id must be unique, you may want to switch to class instead and rethink your logic, but that doesn’t make too much sense anyways because in that loop, as soon as one element is hidden they all would be because your selector is not very specific (applies to every element that matches your selector, looping/repeating that script is redundant).

    There are many ways to approach this but here’s what I suggest: Instead of hiding or removing them with javascript, just don’t output them at all with your PHP code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I am trying to alter my sql code (see below for screenshot of
I have the following code to take a screenshot of a window, and get
I've been trying to code a simple screenshot application using rococoa (java to osx
I've been trying to get a textfield and button to align flush with each
i have been trying to get a screenshot lately but every thing in vain
New to CSS. I am trying to center nested divs using the code below
I have code to create a live screenshot of the stage in my swf.
How can I code an in-app screenshot that can then be attached to a
I use Imager::Screenshot in my Perl code and it does work and takes the
I have the following code: use Imager::Screenshot 'screenshot'; my $img = screenshot(hwnd => 'active',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.