Get all Gravity Form entry IDs for current user and display the highest value

I have a Gravity Form with a user registration plugin installed, so every time someone completes the form, they are added as a user and the submitted form is assigned an entry ID which is linked to that user. But whenever a user re-submits the form a new entry ID is created – there is a column in the "wp_gf_entry" table called "created_by" which contains the user ID for who submitted the form. So I figured I need to find currently logged in user ID, match it against the "created_by" column then find the highest value entry ID for that user, which I will then need to display in a shortcode.

I have figured out how to find the initial entry ID which is linked to the users meta details and display that inside the shortcode, see below.

  $  user_id = get_current_user_id();   $  key = 'entry_id';   $  single = true;   $  gform = get_user_meta( $  user_id, $  key, $  single );     echo do_shortcode('[gravitypdf id="5ffc7508269e7" entry="' . $  gform . '" text="Download"]'); 

This would work great if the entry ID got updated every time the user re-submits the form, as the entry ID would always stay the same, but a new entry ID gets created for every form submission.

So…

That led me to searching for another solution which would update the same entry every time the user re-submitted the form, but I was at a lose and could only find the following gform_entry_id_pre_save_lead which after testing wouldn’t work for me and a new entry was created each time.

Ideally I would prefer the first solution, just in case the user needs to access an older entry. Although its not essential so all suggestions and possible solutions are welcome.

I’m relatively new to PHP, but feel like the solution Is not far away and feel like the use of the foreach loop and the max() function will help with looping through the array of entry IDs for current user and finding the max value in that array…I just can’t figure out how to get there with code!

Any help would be appreciated.

Query to find the second highest row in a subquery

The goal is to send notifications about the customer updates but only for the first one if there are consecutive updates from the customer in a ticketing system.

This is the simplified query that I’m using to get the data that I need. There are a few more columns in the original query and this subquery for threads is kind of required so I can also identify if this is a new ticket or if existing one was updated (in case of update, the role for the latest threads will be a customer):

SELECT t.ref, m.role    FROM tickets t    LEFT JOIN threads th ON (t.id = th.ticket_id)    LEFT JOIN members m ON (th.member_id = m.id)   WHERE th.id IN ( SELECT MAX(id)                      FROM threads                     WHERE ticket_id = t.id                 ) 

It will return a list of tickets so the app can send notifications based on that:

+------------+----------+ | ref        | role     | +------------+----------+ | 210117-001 | customer | | 210117-002 | staff    | +------------+----------+ 

Now, I want to send only a single notification if there a multiply consecutive updates from the customer.

Question:

How I can pull last and also one before last row to identify if this is consecutive reply from the customer?

I was thinking about GROUP_CONCAT and then parse the output in the app but tickets can have many threads so that’s not optimal and there are also a few more fields in the query so it will violate the ONLY_FULL_GROUP_BY SQL mode.

db<>fiddle here

What’s the highest critical hit damage a level 1 character can do?

What’s the highest critical hit damage a level 1 character can do?

Rules:

  • The character must be level 1
  • The character cannot have any magical items
  • The character’s starting equipment must be affordable with the standard 15 gp start
  • The character can be assisted by up to three other level 1 characters with the same restrictions
  • The three assistant characters each have one round before the primary character makes their attack
  • The damage must come off of one critical hit (i.e. the first hit of Flurry of Blows, not both)
  • Max damage can be assumed

What is the highest armour class possible for an Ancient Green dragon?

This posts asks what the highest armour class may be for humanoids. Similar to this question, i would like to know what the highest AC would be for a monster. Narrowing this down, let us look at improvement techniques possible for an ancient Green dragon. As this is a BBED (‘Big Bad Evil Dragon’), they most likely have a slew of minions, guardians and servants – so please feel free to use any options that exist (in 5e) that may be spells, minions, a spare shield guardian, or anything else you like.

For stats on the ancient Green dragon, has a base dexterity of 12 and a base AC of 21. I do not know if it could gain NPC levels of monk or barbarian, nor what use that would have. We can assume this dragon has the ‘optional’ spell casting abilities. According to old (possibly 3.5e) Forgotten Realms material these creatures are a minimum of 800 years old at ‘ancient’ and may live until past 1,200 years or more. They seem to have access to a lot of magic items. These things are gargantuan, so i have no idea, for example, what size shield they would need – or even if a shield works for them. I don’t even know how big ‘cover’ would need to be in order to offer 3/4 protection. Would a Cloak of Protection even fit? I have specifically left this quite open as i would greatly value any and all possibilities that Stack Exchange has to offer.

Let me know if this question is specific enough. The original (above) was seemingly less specific, but Stack Exchange seemed to be enjoying a different mindset at that time.


Question Recap: What is the best armour class possible for a 5e ancient Green dragon – assuming any & all options are available to it.

What is the highest average charisma skill check a solo character can get, without using magic?

I was building a character that had levels in Feywanderer ranger, that gains Otherworldly Glamour which allows you to add wisdom to charisma checks, and then I noticed Samurai fighters get Elegant Courtier which has the same bonus.

Emboldened by the fact they stack, I started to look for other class features that let you reroll failed intimidation checks or gain advantage.

It made me wonder, what is the highest possible charisma skill check by a solo character?

(This means no spells, or magic items and no outside assistance except by summoned/created creatures, e.g. a familiar using the help action is ok, but a party member using flash of genius is not.).

What happens if you reroll and the new highest die is lower than the original?

I was reading the Cthulhu Dark rules again, and I noticed something that wasn’t specified.

The section on rerolling says, in part:

If you included your Insanity die in the roll and you’re not happy with the result, you may reroll (all the dice). If you didn’t include your Insanity die before, you may add it now and reroll.

Afterwards, look at the new result. As before, the highest die shows how well you do.

It does not say anything about what happens if the highest die after rerolling is lower than the highest die before the reroll. Do you still use the new roll if the highest die is lower than the higher die before rerolling?

What is the highest minimum and maximum roll possible on a (Dex) sleight of hand/pickpocket check? [closed]


FOR THE KLEPTOMANIACS OUT THERE:

Let’s say we’re attempting to pickpocket something from someone and would like to reduce our chances of failure as much as possible. What is the highest minimum roll and maximum roll reliably possible in the game? In order to make this easier to replicate for others, I’m going to offer some restrictions:

  • Things that are not largely guaranteed in most games, such as: Boons, Artifacts, and Manuals.
  • This can be any level character up to 20th level, all that matters is that it still remains the highest min and max roll for the check.
  • Must be acting alone and receive assistance only from themselves, their items, feats, racial abilities, class features, etc.

These restrictions should ensure that the check can be performed reliably any time it is made by anyone with the proposed build in nearly any campaign with the average amount of magical items and quest rewards, etc.

I will post my own findings as an answer below. Feel free to use it as a frame for further answers, or offer one all your own.

What is the highest value a condition could reach?

I’m making a Pathfinder 2e character sheet on Google sheet to automate as much number-crunching as possible. Currently, I’m making a dropdown list for conditions, as well as formulas for calculating their penalties.

I find adding conditions with pre-determined values much simpler than conditions with fillable values. For example, instead of clumsy and a blank slot for its value, the dropdown list will have clumsy 1, clumsy 2, clumsy 3, and so on. It’s ugly, but it greatly simplifies the formula. However, if a condition’s value could reach a really high number, then it will be too cumbersome to use.

The highest I have found is stupefied 4 from feeblemind and unfathomable song. I’m also pretty sure I’ve seen an ancestry/heritage/feat which could increase the maximum value of dying to 5.

So what is the highest value/penalty a condition could reach? For the supremely meticulous: what is the highest value each condition could reach?

Whats the highest racial or template charisma boost you can get for a +1 LA?

I’m currently working on a Sha’ir Gish character that will eventually PrC into Zhentarim Skymage(LoD) and I need to buff my charisma as much as possible. Skymage has a gimmick of giving you a paladin mount, or at least a close facially thereof, which can be any creature that’s a size larger than you and has no more hit die than your Skymage level + Charisma mod + 1. I already have Spark(Dragon Mag) for +2. I’m also considering Prestige Races (also Dragon) for another +1. Unseelie Fey is unfortunately banned so that’s not an option. Other than that just about anything official is allowed. I’d prefer to stay at or below LA +1 is possible. Some other options i considered were Athasian Human (also Dragon mag) +2 to two stats, Draconic Creature for +2 to strength, con, and charisma, and savage progression half fey. Spark was ruled to only work on PHB races and not variants like Athasian so that’s probably off the table, and it kind of negates the benefits of any +2 charisma LA 0 race like Spellscale and Savage Progression Aasimar.

I could use magic items like tomes eventually to raise it farther, but i can’t rely on temporary boosts like cloaks of charisma because if my charisma gets lowered, like taking the cloak off, my mount might rebell and attack or abandon me, and that’s not fun for anyone. I’d prefer human for story reasons in the setting and to open up Human paragon as an option for another +2 untyped bonus, though small races aren’t a bad choice either because that opens up a medium mount. I’m aiming for a Wyvern to be my first mount with a True dragon of some kind as my final. Mostly likely a 11-14 hit dice gold dragon for general power and the ability to turn into a smaller animal for easy transportation. Though if anyone want’s to make a better suggestion id be happy to hear it.