bp-legacy: Fix 'Maximum Execution Time' fatal error when attempting to reply to an activity item.

Changes in r8708 caused an infinite loop to occur while manually
determining the activity comment's depth.  This is due to the type casting
in r8708.

To fix this in bp-legacy, we also type cast the various item IDs to prevent
the infinite loop from occurring.

Fixes #5811.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8828 cdf35c40-ae34-48e0-9cc9-0c9da1808c22